{"id":21119,"library":"demisto-py","title":"Demisto API Client","description":"A Python library for interacting with the Palo Alto Networks Cortex XSOAR (formerly Demisto) API. Version 3.2.22 supports Python 3.9–3.13. The library provides methods for incidents, indicators, integrations, jobs, and generic API requests. Maintained by Palo Alto Networks; releases follow roughly monthly cadence.","status":"active","version":"3.2.22","language":"python","source_language":"en","source_url":"https://github.com/demisto/demisto-py","tags":["xsoar","demisto","api-client","cortex"],"install":[{"cmd":"pip install demisto-py","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false}],"imports":[{"note":"demisto-py installs as `demisto_sdk.demisto_client`; direct import of `demisto_client` is a stub.","wrong":"from demisto_client import DemistoClient","symbol":"DemistoClient","correct":"from demisto_sdk.demisto_client import DemistoClient"},{"note":"","symbol":"generic_request_func","correct":"from demisto_sdk.demisto_client import generic_request_func"}],"quickstart":{"code":"from demisto_sdk.demisto_client import DemistoClient\n\nclient = DemistoClient(\n    base_url=os.environ.get('DEMISTO_BASE_URL', 'https://my-dhost.example.com'),\n    api_key=os.environ.get('DEMISTO_API_KEY', ''),\n    verify_ssl=True\n)\nclient.check_health()\n# List all incidents\nincidents = client.search_incidents()\nprint(incidents[:2])","lang":"python","description":"Initialize client and fetch a list of incidents."},"warnings":[{"fix":"Generate an API key from Settings > API Keys in XSOAR and pass as `api_key`.","message":"In v3.0+, `DemistoClient(api_key)` replaced older authentication via username/password. You must now provide an API key, not a password.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use `from demisto_sdk.demisto_client import DemistoClient`.","message":"The correct import path requires a sub-package: `from demisto_sdk.demisto_client import DemistoClient`. `pip show demisto-py` shows the package name but not the import path.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade demisto-py to >=3.2.21.","message":"In v3.2.21+ `pkg_resources` is deprecated; the library now uses importlib.metadata internally. If you see warnings about `pkg_resources`, update to latest version.","severity":"deprecated","affected_versions":">=3.2.21"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from demisto_sdk.demisto_client import DemistoClient`.","cause":"Direct import of `demisto_client` is not the correct module; the package provides `demisto_sdk.demisto_client`.","error":"ModuleNotFoundError: No module named 'demisto_client'"},{"fix":"Open the file handler first: `with open('path', 'rb') as f: client.upload_incident_file(file_obj=f)`.","cause":"Passing a file path string instead of a file-like object to methods that expect files, such as `upload_incident_file`.","error":"AttributeError: 'str' object has no attribute 'read'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}