{"id":21392165,"url":"https://github.com/sysdiglabs/sysdig-sdk-python","last_synced_at":"2025-07-13T18:30:59.084Z","repository":{"id":39866794,"uuid":"45647960","full_name":"sysdiglabs/sysdig-sdk-python","owner":"sysdiglabs","description":"Sysdig Platform Python client library","archived":false,"fork":false,"pushed_at":"2024-05-14T15:28:07.000Z","size":1823,"stargazers_count":63,"open_issues_count":16,"forks_count":43,"subscribers_count":53,"default_branch":"master","last_synced_at":"2024-05-14T22:50:12.181Z","etag":null,"topics":["python","sysdig","sysdig-monitor","sysdig-secure"],"latest_commit_sha":null,"homepage":"https://sysdiglabs.github.io/sysdig-sdk-python","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysdiglabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-06T00:07:04.000Z","updated_at":"2024-05-29T23:26:16.658Z","dependencies_parsed_at":"2024-05-29T23:26:14.368Z","dependency_job_id":"d3596c75-a5cc-4490-b600-d43178c212bc","html_url":"https://github.com/sysdiglabs/sysdig-sdk-python","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysdiglabs%2Fsysdig-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysdiglabs%2Fsysdig-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysdiglabs%2Fsysdig-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysdiglabs%2Fsysdig-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysdiglabs","download_url":"https://codeload.github.com/sysdiglabs/sysdig-sdk-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225908259,"owners_count":17543475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sysdig","sysdig-monitor","sysdig-secure"],"created_at":"2024-11-22T13:39:28.637Z","updated_at":"2024-11-22T13:39:29.321Z","avatar_url":"https://github.com/sysdiglabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sysdig Monitor/Secure Python client library\n===\n\n![CI - Master - Scheduled](https://github.com/sysdiglabs/sysdig-sdk-python/workflows/CI%20-%20Master%20-%20Scheduled/badge.svg)\n[![Current version on PyPI](http://img.shields.io/pypi/v/sdcclient.svg)](https://pypi.python.org/pypi/sdcclient)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sdcclient)\n![PyPI - License](https://img.shields.io/pypi/l/sdcclient)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/sdcclient)\n\nA Python client API for Sysdig Monitor/Sysdig Secure.\n\nThis module is a wrapper around the Sysdig Monitor/Sysdig Secure APIs. It exposes most of the sysdig REST API functionality as an easy to use and easy to install Python interface. The repository includes a rich set of examples (in the [examples](examples/) subdir) that quickly address several use cases.\n\nInstallation\n------------\n#### Automatic with PyPI\n    pip install sdcclient\n\n#### Manual (development only)\n\nThis method requires [Poetry](https://python-poetry.org/) installed\n\n    git clone https://github.com/sysdiglabs/sysdig-sdk-python.git\n    cd python-sdc-client\n    poetry install\n\nQuick start\n-----------\n- If you are interested in exporting metrics data from Sysdig Monitor, take a look at [examples/get_data_simple.py](examples/get_data_simple.py) and [examples/get_data_advanced.py](examples/get_data_advanced.py).\n- If you want to programmatically create an alert, refer to [examples/create_alert.py](examples/create_alert.py)\n- If you want to programmatically create a dashboard, refer to [examples/create_dashboard.py](examples/create_dashboard.py)\n\nUsage\n-----\n\n_Note:_ in order to use this API you must obtain a Sysdig Monitor/Secure API token. You can get your user's token in the _Sysdig Monitor API_ section of the settings page for [monitor](https://app.sysdigcloud.com/#/settings/user) or [secure](https://secure.sysdig.com/#/settings/user).\n\nThe library exports two classes, `SdMonitorClient` and `SdSecureClient` that are used to connect to Sysdig Monitor/Secure and execute actions. They can be instantiated like this:\n\n``` python\nfrom sdcclient import SdMonitorClient\n\napi_token = \"MY_API_TOKEN\"\n\n#\n# Instantiate the Sysdig Monitor client\n#\nclient = SdMonitorClient(api_token)\n```\n\nFor backwards compatibility purposes, a third class `SdcClient` is exported which is an alias of `SdMonitorClient`.\n\nOnce instantiated, all the methods documented below can be called on the object.\n\n#### Return Values\nEvery method in the SdMonitorClient/SdSecureClient classes returns **a list with two entries**. The first one is a boolean value indicating if the call was successful. The second entry depends on the result:\n- If the call was successful, it's a dictionary reflecting the json returned by the underlying REST call\n- If the call failed, it's a string describing the error\n\nFor an example on how to parse this output, take a look at a simple example like [get_data_simple.py](examples/get_data_simple.py)\n\nFunction List \u0026 Documentation\n-----------------------------\n**Work in progress**\n\nFully documented methods is in our roadmap and will be available soon.\n\nOn-Premises Installs\n--------------------\nFor [On-Premises Sysdig Monitor installs](https://support.sysdigcloud.com/hc/en-us/articles/206519903-On-Premises-Installation-Guide), additional configuration is necessary to point to your API server rather than the default SaaS-based one, and also to easily connect when using a self-signed certificate for SSL. One way to handle this is by setting environment variables before running your Python scripts:\n\n```\nexport SDC_URL='https://\u003cYOUR-API-SERVER-HOSTNAME-OR-IP\u003e'\nexport SDC_SSL_VERIFY='false'\n```\n\nAlternatively, you can specify the additional arguments in your Python scripts as you instantiate the SDC client:\n\n```\nclient = SdMonitorClient(api_token, sdc_url='https://\u003cYOUR-API-SERVER-HOSTNAME-OR-IP\u003e', ssl_verify=False)\n```\n\n\nTransitioning from Python to REST\n---------------------------------\n\nIf your goal is to interact with the REST API directly, you can use this Python client library to understand the REST interactions by logging the actions it takes.  This is useful because full documentation of the REST API has not yet been created; and also provides a complete example of known working operations.\n\n- Use or modify an example, or write a new script against the Python sdcclient module.\n- Log the HTTP requests made by the script.\n\nTo log all the requests made by your script in significant detail, add to your script:\n\n``` python\nimport logging\nimport http.client\nhttp.client.HTTPConnection.debuglevel = 1\n\nlogging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests\nlogging.getLogger().setLevel(logging.DEBUG)\nrequests_log = logging.getLogger(\"requests.packages.urllib3\")\nrequests_log.setLevel(logging.DEBUG)\nrequests_log.propagate = True\n```\n\nThen run as normal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysdiglabs%2Fsysdig-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysdiglabs%2Fsysdig-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysdiglabs%2Fsysdig-sdk-python/lists"}