Skip to main content

Python SDK for Sonoran CAD and CMS integrations

Project description

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)
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 communityId for /v2/servers/{communityId} routes and roomId on 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(...) sends locations, tones, and unitColors at 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 429 responses up to 2 times and respect Retry-After when it is provided.
  • Account-targeted CAD v2 helpers accept accountUuid, communityUserId, roblox, discord, and legacy apiId where supported by the backend.
  • The import package remains sonoran.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonoran_py-0.1.17.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonoran_py-0.1.17-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file sonoran_py-0.1.17.tar.gz.

File metadata

  • Download URL: sonoran_py-0.1.17.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sonoran_py-0.1.17.tar.gz
Algorithm Hash digest
SHA256 26b701e1e800528e2d43d623b86d31d439af8e4f3cde7b7a0f84a9843653e044
MD5 458432c2a5398da1f3a29ff7d8ea8305
BLAKE2b-256 b6fce3502005c197f09b4283a76fe14a8f50718187e51adf00389600cffb7211

See more details on using hashes here.

Provenance

The following attestation bundles were made for sonoran_py-0.1.17.tar.gz:

Publisher: release.yml on Sonoran-Software/Sonoran.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sonoran_py-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: sonoran_py-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sonoran_py-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 38e7407060ba7b9f2ed451e3bd8089add6481f7d8e02d784c2070f77fcc4c145
MD5 b1bc150bc76df8c7d161fd7361798539
BLAKE2b-256 181ce8bf294ce5b11b411214a6170bef64d7d039ff6212e4759f917c98737827

See more details on using hashes here.

Provenance

The following attestation bundles were made for sonoran_py-0.1.17-py3-none-any.whl:

Publisher: release.yml on Sonoran-Software/Sonoran.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page