pysophoscentral
A Python client library for the Sophos Central API.
Status: work in progress (pre-1.0). The API surface is incomplete and may change between minor releases without notice. This release is published to reserve the package name; a stable 1.0 is on the roadmap.
Features
- OAuth2 client-credentials authentication and tenant resolution (
whoami) - Endpoints: list, read, filter (Endpoint API v1)
- Directory users: list, read, create, update, delete (Common API v1)
- Alerts and account health check
- Typed request/response models built on Pydantic v2
Requirements
- Python 3.12+
Installation
pip install pysophoscentral
Quickstart
Configuration is loaded from a TOML file:
# settings.toml
[sophos_central]
base_url = "https://api.central.sophos.com/"
auth_endpoint_url = "https://id.sophos.com/api/v2/oauth2/token"
auth_client_id = "<your-client-id>"
auth_client_secret = "<your-client-secret>"
api_version = "v1"
from pysophoscentral.api import SophosCentralClient
from pysophoscentral.settings import AppSettings
settings = AppSettings(_env_file="settings.toml")
client = SophosCentralClient(settings.sophos_central)
client.authenticate() # obtain the OAuth2 access token
client.read_whoami() # resolve tenant id and data region (required)
endpoints = client.read_endpoints()
for endpoint in endpoints.items:
print(endpoint.id, endpoint.hostname)
Note: authenticate() and read_whoami() must be called, in this order,
before any other API call.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysophoscentral-0.2.0.tar.gz.
File metadata
- Download URL: pysophoscentral-0.2.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e19bcad53f257727fd99aecb89f0cf8776714bc2e331559a685bf003e148f559
|
|
| MD5 |
96112c844db14e197c7e56b3b128f480
|
|
| BLAKE2b-256 |
230d84aeeb148dfb5c27e145d23ae7940c6b7baad8151257058e7c7ec0038004
|
File details
Details for the file pysophoscentral-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pysophoscentral-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7356573378b622c0a0d96e3f83c8b8474a5e7fe49157adc35411da209eb39718
|
|
| MD5 |
cf9ac3ee27b89c55e2c6764bad4739b2
|
|
| BLAKE2b-256 |
8a2bb1d9960705275d8d18632290eb578f43ccece7ecfbed8460ae9d522e883f
|