Skip to main content

Async client for the Noonlight Dispatch API

Project description

noonlight-dispatch

A small, typed, async Python client for the Noonlight Dispatch API (/dispatch/v1). Built on httpx, it accepts a shared client/session so it slots cleanly into apps like Home Assistant.

It handles the Noonlight wire-format quirks for you: phone numbers are sent as digits with a country code but no leading +, and US states as the uppercase 2-letter code.

Install

pip install noonlight-dispatch

Usage

import httpx
from noonlight_dispatch import NoonlightClient, SANDBOX_BASE_URL

async def main():
    async with httpx.AsyncClient() as session:
        client = NoonlightClient(session, "YOUR_TOKEN", base_url=SANDBOX_BASE_URL)

        alarm = await client.create_alarm(
            services=["police"],
            name="Jane Doe",
            phone="+1 (202) 555-0142",   # stored/sent as 12025550142
            address="123 Main St",
            city="Springfield",
            state="va",                  # sent as VA
            zip_code="62704",
            instructions="Triggered by Front Door motion",  # -> instructions.entry
            owner_id="Site A",           # caller-defined site identifier
        )
        alarm_id = alarm["id"]

        status = await client.get_alarm_status(alarm_id)
        await client.cancel_alarm(alarm_id)

SANDBOX_BASE_URL never alerts real responders — use it for testing. PRODUCTION_BASE_URL is the default.

Errors

All failures raise a subclass of NoonlightError:

  • NoonlightAuthError — token rejected (401/403)
  • NoonlightConnectionError — unreachable / timeout
  • NoonlightResponseError — unexpected status or body (carries .status_code)

Development

pip install -e ".[test]"
pytest

License

MIT

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

noonlight_dispatch-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

noonlight_dispatch-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file noonlight_dispatch-0.1.1.tar.gz.

File metadata

  • Download URL: noonlight_dispatch-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for noonlight_dispatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2682ae095c2c2b7cd1777217255c75784393c206b43587d254e81bfe666e243c
MD5 33219506d357e6e820d8e377eafe3fb4
BLAKE2b-256 f1f9756561d370602a3b85d16e268fab84ee6d7262762cf149a043469765b205

See more details on using hashes here.

File details

Details for the file noonlight_dispatch-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for noonlight_dispatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e85cf08cc940eb0e1b35500f87b3af982bd828c91393e59c899a52d811e04afb
MD5 10e70a0f1187dbe2ef74b0464f41099f
BLAKE2b-256 74d9868d212b7a7c4e621886082893e3176f9cadf7bdfa1ab2cfd376c6edab3e

See more details on using hashes here.

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