Python
The Python client uses HTTP/JSON against the clone API. This is not
CrowdStrike production. Base URL on Compose is
http://crowdstrike-api.localhost:8088.
The product sample is Hosts query_devices (GET /devices/queries/devices/v1).
hello is a sample health call, not a Falcon collection.
import os
from platform_sdk import PlatformClient
c = PlatformClient(
base_url="http://crowdstrike-api.localhost:8088",
token=os.environ.get("PLATFORM_TOKEN"),
)
print(c.query_devices())
print(c.query_devices("hostname:'win*'"))
Hello sample
from platform_sdk import PlatformClient
c = PlatformClient(base_url="http://crowdstrike-api.localhost:8088")
c.healthz()
print(c.hello())
Install
- macOS
- Linux
- Windows
python3 -m venv .venv
source .venv/bin/activate
pip install -e ./sdk/python
Use a virtualenv so the package stays in the project.
python3 -m venv .venv
source .venv/bin/activate
pip install -e ./sdk/python
On Debian/Ubuntu, install python3-venv and python3-pip if venv is
missing.
Install Python 3.9+ and tick Add python.exe to PATH. In PowerShell:
py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .\sdk\python
If activation is blocked:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.