Skip to main content

quicnz

Async Python library for the Quic broadband API.

Quic exposes an API at https://api.quic.nz/v1/ that gives customers access to their service configuration, live session data (connection status, assigned IP addresses, PPPoE/DHCP details), and a network weather map. This library wraps that API with a clean, fully-typed async interface built on aiohttp.

Home Assistant integration: A separate ha-quicnz custom integration that uses this library as a dependency is maintained at https://github.com/ageron/ha-quicnz

Disclaimer: This project is an independent, community-maintained library and is not affiliated with, endorsed by, or supported by Quic Broadband / Vetta Trading Ltd in any way. Use it at your own risk.


Requirements

  • Python 3.11+
  • aiohttp ≥ 3.9

Installation

pip install quicnz

Getting an API key

Log in to the Quic portal, select a service, navigate to the bottom of the page, below your product details, and you should find your API key. If the field is empty, click "Roll API Key" to generate the key.

Quick start

import asyncio
from quicnz import QuicClient

async def main():
    # api_key can also be supplied via the QUICNZ_API_KEY environment variable
    async with QuicClient(api_key="YOUR_API_KEY") as client:
        # List all services associated with your account
        service_ids = await client.get_services()
        print("Services:", service_ids)

        # Fetch the active session for the first service
        session = await client.get_session(service_ids[0])
        print("Connected:", session.is_connected)
        print("IPv4:", session.active_ipv4_prefix)
        print("IPv6:", session.active_ipv6_prefix)
        print("LFC:", session.service.lfc)

asyncio.run(main())

Or omit api_key and set the environment variable instead:

export QUICNZ_API_KEY="YOUR_API_KEY"
async with QuicClient() as client:
    ...

Reusing an aiohttp session

If your application already manages an aiohttp.ClientSession you can pass it in to avoid creating an extra connection pool:

import aiohttp
from quicnz import QuicClient

async with aiohttp.ClientSession() as http_session:
    client = QuicClient(api_key="YOUR_API_KEY", session=http_session)
    session = await client.get_session("service123")

API reference

QuicClient(api_key=None, *, session=None)

Main entry point. Use as an async context manager or pass an existing aiohttp.ClientSession. If api_key is omitted, the QUICNZ_API_KEY environment variable is used. A ValueError is raised if neither is provided.

Method Returns Description
get_services() list[str] Service IDs authorised for this API key
get_session(service_id) Session Active session for a service
get_weathermap(source="website") bytes Weather map image bytes (website or API source)

Session

Attribute Type Description
status str e.g. "connected"
is_connected bool True when status == "connected"
session_type str "DHCP" or "PPPoE"
active_ipv4_prefix str Assigned IPv4 address
active_ipv4_prefix_length int IPv4 prefix length
active_ipv6_prefix str Assigned IPv6 prefix
active_ipv6_prefix_length int IPv6 prefix length
last_radius_update datetime Last RADIUS accounting update
session_expires_at datetime When the session expires
ppp_payload PPPPayload | None PPPoE session details (PPPoE only)
service ServiceInfo Static service configuration
created_at datetime
updated_at datetime

ServiceInfo

Attribute Type Description
username str PPPoE/DHCP username
lfc str Local Fibre Company (e.g. "Chorus")
status str Service status (e.g. "active")
asid str AS identifier
datacap float Data cap (0 = uncapped)
static_ipv4_prefix str Static IPv4 prefix (if any)
static_ipv6_prefix str Static IPv6 prefix (if any)
routes list[str] Announced routes

Exceptions

Exception When raised
QuicAuthError HTTP 403 – invalid or missing API key
QuicNotFoundError HTTP 404 – resource not found
QuicAPIError Any other HTTP error; has .status: int attribute
QuicError Base class for all quicnz exceptions

Rate limits

The Quic API enforces a limit of 120 requests per minute. Session data is cached server-side for 5 minutes; the weather map is cached for 6 minutes.

The default weather map source is the website endpoint. Use the API endpoint explicitly if preferred:

image = await client.get_weathermap(source="api")

Development

# Clone and install in editable mode with dev extras
git clone https://github.com/ageron/quicnz
cd quicnz
pip install -e ".[dev]"

# Run tests
pytest

# Lint / type-check
ruff check src tests
mypy src

Licence

MIT

Metadata

Release files for quicnz 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quicnz 0.1.2
File Size Uploaded Provenance Actions
quicnz-0.1.2.tar.gz 12.3 kB Without provenance Details for quicnz-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quicnz 0.1.2
File Interpreter ABI Platform Actions
quicnz-0.1.2-py3-none-any.whl Python 3 none any Details for quicnz-0.1.2-py3-none-any.whl

Total release size: 21.3 kB

Release files / quicnz-0.1.2.tar.gz

Download URL quicnz-0.1.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
df6191b496410cb021071a5d8e4925bdf188c6a84022beb677707475c8464544
BLAKE2b-256 checksum
How to use checksums
084012c82d1941450a371c2f770ccdf132a5271f3876b103d671cbc035678f4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / quicnz-0.1.2-py3-none-any.whl

Download URL quicnz-0.1.2-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
834f3cd9b2335b5c0af8ca353352b1df6979bf681523cb1f4a1e7a275df9f309
BLAKE2b-256 checksum
How to use checksums
55ac834d705bd96c5040cce5d7cc2a0243e3bff440345843599060360b44083d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for quicnz 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page