Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Check Networks API for Python

The official Python client for the Check Networks API. It is generated from the API's OpenAPI document, so every endpoint and field is there, and it adds what every integration needs:

  • Signing in. It gets an access token with your API key's Client ID and Client Secret, keeps it, and gets a new one shortly before it expires (a token lasts an hour). A 401 makes it get a new token and try once more.
  • Safe retries. Every write (POST, PUT, PATCH, DELETE) carries an Idempotency-Key, so a retry never does the work twice. Send your own key to keep one across your own retries.
  • Waiting when asked. A 429, 503 or 409 with a Retry-After header is waited out and sent again, up to twice by default.

The client's version is the API document's version.

Install

pip install checknetworks

Python 3.11 or later.

Get a key

Build against the sandbox first: a separate copy of the platform where nothing reaches a carrier. Its base URL is https://api.checknetworks.dev/v2. Ask your Account Manager for one, then create an API key in the sandbox portal under Company Settings → Integrations → API Keys. A sandbox secret starts cn_test_. See The API sandbox.

Token, ping and a first read

import os

import checknetworks
from checknetworks.api.account import get_account
from checknetworks.api.authentication import ping

cn = checknetworks.create_client(
    os.environ["CN_CLIENT_ID"],
    os.environ["CN_CLIENT_SECRET"],  # cn_test_…: the sandbox
    scope=["account:read"],
    base_url=checknetworks.SANDBOX_BASE_URL,  # https://api.checknetworks.dev/v2
)

# The token: fetched on the first call, or now if you ask for it.
cn.tokens.get()
print(cn.tokens.scopes)  # what the token really carries

# GET /ping: which key, account and environment answered.
me = ping.sync(client=cn)
print(me.result.account_id, me.result.environment)  # … sandbox

# GET /account: your account's details.
account = get_account.sync(client=cn)
print(account.result.client_number, account.result.status)

Leave out base_url and the client picks it from the secret: cn_test_ is the sandbox and cn_live_ production. In production every call runs against your real account, and a carrier write places a real order.

Every endpoint is a module under checknetworks.api, named by its tag and operation, with sync, sync_detailed, asyncio and asyncio_detailed. The _detailed forms return the status code and headers too. A call answered with a status the document does not list raises checknetworks.errors.UnexpectedStatus; pass raise_on_unexpected_status=False to get None instead. A refused token request raises checknetworks.AuthError.

Options

create_client(client_id, client_secret, scope, *, base_url, max_retries=2, max_retry_wait=60, timeout=30, raise_on_unexpected_status=True). A Retry-After longer than max_retry_wait seconds is not waited: the response comes back to you.

More

Licence

This library is MIT licensed: see LICENSE. The Check Networks API it calls is used under your agreement with Check Networks and the API Terms.

Metadata

Release files for checknetworks 2.0.0rc6

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

Source distribution (sdist)

Source distribution for checknetworks 2.0.0rc6
File Size Uploaded Provenance Actions
checknetworks-2.0.0rc6.tar.gz 1.6 MB Without provenance Details for checknetworks-2.0.0rc6.tar.gz

Built distribution (wheel)

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

Total release size: 5.2 MB

Release files / checknetworks-2.0.0rc6.tar.gz

Download URL checknetworks-2.0.0rc6.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
c7dc308bb41f4c2a784bfffc3ce43f19134e85ffed8d20e7c7712ede0a81ad6f
BLAKE2b-256 checksum
How to use checksums
115373eb1cf24c691c4a83e41223d33fe391110ea3df2b440ded6cc0b82fc698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / checknetworks-2.0.0rc6-py3-none-any.whl

Download URL checknetworks-2.0.0rc6-py3-none-any.whl
Size 3.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d9ed176e4cec416b0a7637d9b136676c8d3ee28cf285943c4c9b9d7f5e0ab93f
BLAKE2b-256 checksum
How to use checksums
f98c402de46083f59ef17fb9b560776f08150d95fa906150968d5569e5c2b048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.14.4

Security for checknetworks 2.0.0rc6

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.

Release history Release notifications | RSS feed

This release
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