Sonoran.py
Sonoran.py is the Python library for Sonoran CAD and Radio integrations.
This repository currently focuses on the CAD and Radio v2 API surfaces and mirrors the public helper names from Sonoran.js.
Install
pip install Sonoran.py
Example Usage
from sonoran import Instance, productEnums
instance = Instance(
apiKey="YOUR_API_KEY",
communityId="YOUR_COMMUNITY_ID",
product=productEnums.CAD,
serverId=1,
)
response = instance.cad.createEmergencyCallV2(
{
"serverId": 1,
"isEmergency": True,
"caller": "John Doe",
"location": "101 Alta Street",
"description": "Structure fire with visible smoke.",
"deleteAfterMinutes": 30,
}
)
if response.success:
print(response.data)
else:
print(response.reason)
penal_codes = instance.cad.getPenalCodesV2()
if penal_codes.success:
print(penal_codes.data)
link_response = instance.cad.setCommunityLinkV2(
{
"accountUuid": "USER_ACCOUNT_UUID",
"secretUuid": "USER_ACCOUNT_SECRET_UUID",
"communityUserId": "fivem:12345",
}
)
location_response = instance.cad.updateUnitLocationsV2(
{
"serverId": 1,
"updates": [
{
"roblox": 123456789,
"location": "Mission Row",
}
],
}
)
with open("bodycam-clip.webm", "rb") as clip:
bodycam_response = instance.cad.uploadBodycamRecordingV2(
{
"accountUuid": "USER_ACCOUNT_UUID",
"durationMs": 90000,
"identId": 123,
"unitNumber": "1A-12",
"unitLocation": "Senora Fwy / Route 68",
"fileName": "bodycam-clip.webm",
"fileContent": clip.read(),
"contentType": "video/webm",
}
)
Notes
- CAD and Radio v2 helpers are included right now.
- Helper names match
Sonoran.js. - Radio v2 clients use
communityIdfor/v2/servers/{communityId}routes androomIdon client creation for room-scoped helpers:
radio = Instance(
apiKey="YOUR_RADIO_API_KEY",
communityId="YOUR_COMMUNITY_ID",
product=productEnums.RADIO,
roomId=2,
)
radio.setRoomId(1)
instance.cad.setStationsV2(...)sendslocations,tones, andunitColorsat the top level of the request body.- Bodycam uploads use
instance.cad.uploadBodycamRecordingV2(...)with multipart form data built by the SDK. - CAD v2 requests automatically retry
429responses up to 2 times and respectRetry-Afterwhen it is provided. - Account-targeted CAD v2 helpers accept
accountUuid,communityUserId,roblox,discord, and legacyapiIdwhere supported by the backend. - The import package remains
sonoran.
Granular CAD permissions (v2)
Use getPermissionCatalogV2, getAccountPermissionsV2, and replaceAccountPermissionsV2 for new permission integrations. The existing setAccountPermissionsV2 remains a legacy category adapter.
catalog = instance.cad.getPermissionCatalogV2()
account = instance.cad.getAccountPermissionsV2(account_uuid)
response = instance.cad.replaceAccountPermissionsV2(account_uuid, ["global.police"])
# Clear all grants explicitly:
cleared = instance.cad.replaceAccountPermissionsV2(account_uuid, [])
Use the account UUID, not a community user ID, in these calls. Fetch the community catalog for exact, case-sensitive grant IDs and template IDs; legacyGrants maps uppercase legacy flags to current grants. Replacement overwrites the full grant list (version 2), and an empty list clears it. Never treat a failed read as an empty list. Only pending or active non-owner accounts can be edited. Nonempty grants activate pending accounts subject to the member limit; empty grants make active accounts pending. A granular save ends legacy category inheritance for future record templates.
Full and selected-field editing
Discover support from getPermissionCatalogV2(): use record.<templateId>.edit.selected only when that exact grant is returned. It requires the updated CAD backend and may not yet be available during rollout. No SDK method or permission-document version change is required.
edit.own: full editing of records owned by the account.edit.any: full editing of anyone's records, including the account's own records; field opt-in does not limit this grant on the updated backend.edit.selected: editing only fields marked Allow limited editing (editableByOthers: true) on another account's records. It does not includeedit.ownoredit.any.supervise: an additional requirement for supervisor-only fields; it does not grant editing by itself or bypass limited-field opt-in. Read-only fields remain locked for account editing.
Existing grants and field settings are preserved, and the new grant is not automatically assigned. For limited access, remove that template's edit.any grant from every source and assign edit.selected instead; optionally retain edit.own. Permissions from keys or role mappings may combine, and any remaining edit.any grants full editing. Fetch the account first and preserve unrelated grants when replacing its complete permission set. Never treat a failed read as an empty grant list. Community API-key record operations retain their existing service authority; these grants govern community accounts.
Metadata
Release files for Sonoran.py 0.1.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sonoran_py-0.1.25.tar.gz | 16.4 kB | With provenance | Details for sonoran_py-0.1.25.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sonoran_py-0.1.25-py3-none-any.whl | Python 3 | none | any | Details for sonoran_py-0.1.25-py3-none-any.whl |
Total release size: 31.4 kB
Release files / sonoran_py-0.1.25.tar.gz
| Download URL | sonoran_py-0.1.25.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
512565191d50b7c1e1135f1519adf446ad91e4fa1ed9062ffed28a57321397c4
|
|
BLAKE2b-256 checksum How to use checksums |
522b0060e498667aabbb005a0195455f150d53e8ad43c8a81d4bd3d4c2756a97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / sonoran_py-0.1.25-py3-none-any.whl
| Download URL | sonoran_py-0.1.25-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
210e91722a15c5aabc5e8f021b1e8b012267d0c1cd561b1c3a3e56d166036a1f
|
|
BLAKE2b-256 checksum How to use checksums |
e925c5c130cbe8d36dc59f12b4695a97aab251bb48f5b975b662da8262f505d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logSecurity for Sonoran.py 0.1.25
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sonoran_py-0.1.25.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.