Skip to main content

Apify badge assignment for badgecollector.org via GitHub repository_dispatch or the relay Worker.

Project description

badgecollector

Python client for badgecollector.org — apify badge assignment via GitHub repository_dispatch or the relay Cloudflare Worker.

Stdlib only. No requests, no httpx. Python 3.8+.

Install

pip install badgecollector

Use

Two auth modes — pick one per call.

Worker path (recommended)

A bk_* key from the register-client workflow plus the Worker URL.

import os
from badgecollector import award_badge

result = award_badge(
    api_key=os.environ["BC_API_KEY"],
    worker_url="https://badgecollector-worker.sirmmo.workers.dev",
    badge_id="early-adopter",
    email="user@example.com",                  # hashed locally; never sent
    expires_at="2027-06-09T00:00:00Z",
    evidence="https://example.com/transcript",
)
print(result["recipient_page"])

Direct dispatch

A GitHub PAT with Actions: write + Contents: read on the repo.

result = award_badge(
    token=os.environ["GH_TOKEN"],
    badge_id="early-adopter",
    email="user@example.com",
    client_id="acme-corp",
)

API

hash_email(email: str) -> str
# SHA-256 hex of nfc(lowercase(trim(email))).

award_badge(*, badge_id, email=None, email_hash=None,
            api_key=None, worker_url=None, token=None,
            expires_at=None, evidence=None, client_id=None,
            owner="sirmmo", repo="badgecollector") -> dict

await_award_completion(*, token, triggered_at,
                       owner="sirmmo", repo="badgecollector",
                       timeout_s=120.0, interval_s=4.0) -> dict

# Raises AwardError on upstream rejection, ValueError on invalid input.

See CLAUDE.md for the full system specification.

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

badgecollector-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

badgecollector-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file badgecollector-0.1.0.tar.gz.

File metadata

  • Download URL: badgecollector-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for badgecollector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f562bbeff8f54f270fb42a41de96c709465d9fd67e3ead6174dabf471c28b35
MD5 7edc08774d29447e37b1dd474c20745b
BLAKE2b-256 e12897d6fe03084a8ccb4444480e0a1c4a561359c62bd95bb61c31fb540235a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for badgecollector-0.1.0.tar.gz:

Publisher: publish-pypi.yml on sirmmo/badgecollector

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

File details

Details for the file badgecollector-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: badgecollector-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for badgecollector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 315d7f4c1d4bfebd00a3021c1f3704ca301b3869fcab4c26ce1e0b2f78a3c823
MD5 96c58786d38fc2ddec869255ea2d78d4
BLAKE2b-256 f403b63c93225ea66a0dbae9c7674462e81b6a3140bd1ff31034bb0ef0ea324a

See more details on using hashes here.

Provenance

The following attestation bundles were made for badgecollector-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on sirmmo/badgecollector

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