Skip to main content

AudienceKit for Python

The audiencekit package: an audience's venues, people, locales, events and the signed-in person's own state, over the AudienceKit GraphQL API (https://api.audiencekit.com/v1/audience/<audience id>/graphql). Python 3.10 or newer, on httpx, with a blocking Client and an asyncio AsyncClient that take the same calls. Typed throughout (py.typed).

It carries the same documents and models as the Swift and Kotlin SDKs in this repository, so an app or a service built with it reads the API the way the apps do, with the same tolerance for audiences that haven't installed a module.

Installation

pip install audiencekit

Or, from this repository: pip install ./python.

Usage

from audiencekit import Client, Configuration, Credential, DeviceDescription

client = Client(Configuration(host="hotmess.social"))

# Either sign a person in with a Facebook (or Apple) token the app obtained…
credential = client.sign_in_with_facebook(facebook_access_token, DeviceDescription("install-id"))
# …or adopt a credential minted elsewhere (a service token from the console, or one you saved):
client.adopt(Credential.from_json(saved_json))

for event in client.events():  # soonest first; window="PAST" for the latest
    print(event.name, event.start_at, event.venue_name, event.rsvp and event.rsvp.count)

venues = client.venues()
people = client.people()
me = client.me()
client.rsvp_event(event.id, "ATTENDING")

The same calls on asyncio:

async with AsyncClient(Configuration(host="hotmess.social"), credential=credential) as client:
    venues = await client.venues()

Your own operations

client.graphql(query, variables, operation_name) runs any document against the audience's endpoint and returns its data; client.run(Operation(...)) adds the module-tolerant retry below to one of your own. Both take an endpoint for packages built for other views of the API ("graphql", the consumer view, by default).

Modules the audience doesn't have

The API leaves a module's fields out of an audience that hasn't installed it (Facebook Pages, Google Places, RSVP, Ticketing, Friends…), and asking for one fails the whole operation with undefinedField. The typed calls first ask for everything; when the API refuses a field they ask the schema which fields the operation's types have, cache the answer for the session, and run the operation again with only those. The models' module fields (Event.rsvp, Venue.page, Person.home_venue…) are None when the audience doesn't have them.

Errors

Every failure raises AudienceKitError, with a code from the API's vocabulary (UNAUTHENTICATED, FORBIDDEN, NOT_FOUND, INVALID with per-field messages in fields, RATE_LIMITED, CONFLICT, INTERNAL) or the SDK's own (NOT_SIGNED_IN, SIGN_IN_REJECTED, NETWORK, DECODING, MISSING_CONFIGURATION, UPDATE_REQUIRED…), the message, the HTTP status when there was one, and the GraphQL errors when the operation returned any. When the API rejects the session (HTTP 401), the client forgets the credential and tells your on_session_change listener session_ended; sign in again.

Headers

Every call carries Authorization: Bearer <token>, X-AudienceKit-API-Version (the contract date this SDK speaks), X-AudienceKit-Client: AudienceKit-Python/<version> and, for staging builds (Configuration(environment="staging")), X-AudienceKit-Environment: staging.

Development

cd python
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest --cov          # fails under 85% line coverage, the repository's floor
ruff check . && ruff format --check . && mypy

The tests run against a fake API behind httpx.MockTransport (tests/conftest.py), which records every request the client sends and answers each GraphQL operation by name.

Versioning and releases

The package keeps its own version in src/audiencekit/_version.py, separate from the Swift and Kotlin SDKs' VERSION at the repository root, and the root release job doesn't publish it. Add the version's entry to CHANGELOG.md. Once a change that raises the version merges to main, the python-release workflow builds the sdist and wheel, uploads them to PyPI with trusted publishing (PyPI's publisher names lwm-luminx/audience-kit-sdk, workflow python-release.yml, environment pypi), and tags the commit python-<version> (the prefix keeps it apart from the Swift package's bare 0.42.0 tags, which Swift Package Manager resolves).

License

Source-available under the AudienceKit SDK License 1.2 (LicenseRef-AudienceKit-SDK-1.2), © Love Wins Media, Inc.: use it only in apps that connect to AudienceKit as hosted by Love Wins Media. Every other use is prohibited without Love Wins Media's written permission and an audience ID or token issued for that use. No other license is granted, misrepresenting the work is prohibited, and changed versions may be made only in a fork after written notice. See the root README for details.

Metadata

Release files for audiencekit 0.1.0

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

Source distribution (sdist)

Source distribution for audiencekit 0.1.0
File Size Uploaded Provenance Actions
audiencekit-0.1.0.tar.gz 39.8 kB With provenance Details for audiencekit-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 71.6 kB

Release files / audiencekit-0.1.0.tar.gz

Download URL audiencekit-0.1.0.tar.gz
Size 39.8 kB
Tags Source
SHA-256 checksum
How to use checksums
29aa642c6be5a75d93101058cb87e43183daec98321bc5da2dde42b1eb41055a
BLAKE2b-256 checksum
How to use checksums
294efebf5ed24880a93f7823645217c949836c05700586f5b94b49ac01158006
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / audiencekit-0.1.0-py3-none-any.whl

Download URL audiencekit-0.1.0-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cd28c421106b12b7da568aa6fb620473e2f00ffe02cbcf6b9430aad2ebba44a
BLAKE2b-256 checksum
How to use checksums
53bdd4d04e84c6c3cf9279a865c77a899d79a26e0fbbc5ed36ea7700eaf754e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Security for audiencekit 0.1.0

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.

Select from 2 files

Attestation for audiencekit-0.1.0.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 Nov 25, 2026.

Transparency log

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

0.1.0 This release

2 release files Full provenance

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