teleport-tap-sdk (Python)
The Python SDK for the Teleport TAP API. Use it to post physical work, send it to the people who can do it, verify the evidence they send back, and get a Teleport PoPW receipt: a Proof of Physical Work record anchored on Base. It also checks the signed webhooks Teleport sends you.
- Requirements: Python 3.10+. The only dependency is
cryptography, used for signature checks. - Generated from the spec: every operation in the OpenAPI spec can be reached with
call(), and every schema is aTypedDictinteleport_tap.models. - TypeScript: the same SDK is on npm as
teleport-tap-sdk.
pip install teleport-tap-sdk
Quickstart
from teleport_tap import Teleport
teleport = Teleport() # reads TELEPORT_API_KEY; or Teleport("tp_live_…")
posted = teleport.templates.create_task("shelf-restock", {
"locationId": "loc_…",
"spot": "Cooler 4",
"routing": {"audience": "LOCATION_STAFF"},
})
task = teleport.tasks.get(posted["task"]["id"])
To try it without anyone being alerted or anything being anchored, use a test key (tp_test_…). Then move the task along yourself; the same webhooks fire as for live work:
teleport.sandbox.simulate(task_id, {"action": "submit_evidence"})
teleport.sandbox.simulate(task_id, {"action": "accept"})
| Namespace | Methods |
|---|---|
tasks |
create, get, find, events, submit_evidence, create_uploads, create_capture_link |
routes |
start, get, cancel, escalate |
routing_policies |
get, set |
verifications |
create, get, submit_evidence |
templates |
list, get, create_task |
receipts |
get_claim, get_proof, get_batch, verify |
proof_network |
encoding, assurance_policies, verification_policies |
webhooks |
create, list, get, delete, replay, verify |
sandbox |
simulate |
account |
me, register_agent |
Anything else, by its operationId:
teleport.call("getSite", path={"id": "site_…"})
Every failed call raises TeleportError, which carries status, code, message, details and request_id. Reads are retried on network errors, 429 and 5xx. Writes are retried only on 429, because a write that never answered may still have been processed.
Troubleshooting: tls_error
TeleportError with code tls_error ("Couldn't verify Teleport's TLS certificate") means this Python has no CA certificates to check against. Teleport's certificate is publicly trusted, so it's the local setup:
- python.org installer on macOS: run
/Applications/Python 3.x/Install Certificates.commandonce. - Anywhere else:
pip install certifi, thenexport SSL_CERT_FILE="$(python -m certifi)".
Don't turn certificate verification off. These errors aren't retried, since a retry fails the same way.
Webhooks
Teleport signs every outcome event with ES256: a detached JWS in the Teleport-Signature header. Verify the raw body before you act on it:
from teleport_tap import WebhookVerificationError, verify_webhook
@app.post("/teleport") # FastAPI; Flask and Django work the same way
async def teleport_webhook(request: Request):
raw = await request.body()
try:
event = verify_webhook(raw, request.headers)
except WebhookVerificationError:
return Response(status_code=400)
if event["type"] == "task.accepted":
... # dedupe on event["eventId"]: delivery is at least once
return {"ok": True}
- Signing keys: fetched from
https://api.teleport.eco/.well-known/teleport-outcome-keys.jsonand cached for 10 minutes. When a key id isn't in the cache, the keys are fetched again, so key rotation works. - Age limit: deliveries signed more than 5 minutes ago are refused. Change this with
tolerance_seconds. - Route events: you also get
route.offered,route.claimed,route.released,route.exhaustedandroute.cancelled, with details inevent["route"]. - Paused webhooks: if deliveries fail for 3 days, Teleport pauses the subscription and emails your organization's owners. Catch up with
teleport.webhooks.replay(subscription_id, "2026-11-16T00:00:00Z").
Verify a receipt without trusting Teleport
from teleport_tap import verify_receipt
check = verify_receipt("claim_62d4wz7njqgazpa6")
check["verified"] # True: the claim hash recomputes, and it's in the anchored batch
check["claimHash"] # {"published", "recomputed", "matches"}
check["onChain"] # the last check, on Base: PhysicalWorkRegistry.batchOf(batchId)
- What it checks: it fetches the claim's public proof (no key needed). Then, on your machine, it recomputes the claim hash from its 25 committed fields under the EIP-712 domain, and folds the Merkle inclusion proof up to the batch root.
- Lower-level tools:
teleport_tap.popwhas Keccak-256, JCS document hashes, the claim hash, Merkle proofs, and the TAP v0.3 draft.3 constructions. It's tested against the published test vectors.
For providers (TAP Provider Protocol)
Supply platforms take Teleport jobs through the TAP Provider Protocol. Apply at teleport.eco/protocol/providers/apply.
from teleport_tap import TeleportProvider, verify_provider_event
provider = TeleportProvider() # your provider key (tp_test_… in the sandbox)
offers = provider.list_offers()["offers"]
job = provider.accept(offers[0]["offerId"], {"performerRef": "worker-7731"})
provider.update_status(job["assignmentId"], {"status": "ON_SITE"})
provider.payouts() # Stripe payouts: paid per job once the requester's payment succeeds
Every call carries Teleport-Provider-Version, and every write gets a fresh Idempotency-Key.
For push delivery, check each event with verify_provider_event(raw_body, headers). It uses the provider keys and refuses outcome-webhook signatures. Dedupe on eventId, and ignore event types you don't know.
Changes
- 0.1.1: a TLS certificate this Python can't verify raises
tls_errorwith the fix, instead of "Couldn't reach Teleport", and isn't retried. Other network errors keep their underlying reason. Fetching signing keys reports the same way. - 0.1.0: first release.
License
MIT
Metadata
Release files for teleport-tap-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| teleport_tap_sdk-0.1.1.tar.gz | 63.2 kB | Without provenance | Details for teleport_tap_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| teleport_tap_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for teleport_tap_sdk-0.1.1-py3-none-any.whl |
Total release size: 113.4 kB
Release files / teleport_tap_sdk-0.1.1.tar.gz
| Download URL | teleport_tap_sdk-0.1.1.tar.gz |
|---|---|
| Size | 63.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2319d81106c5373d82593dab651367a80aa0bb861ed96047376d0c984d02f2c3
|
|
BLAKE2b-256 checksum How to use checksums |
d8eff0471720c65823249ec64d780c7549689c196106d258e6d97b9ba4139181
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Release files / teleport_tap_sdk-0.1.1-py3-none-any.whl
| Download URL | teleport_tap_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 50.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47140ccee09ea1011605152ff9a982c2571e7e71e09615dc2b855bcf865ea730
|
|
BLAKE2b-256 checksum How to use checksums |
0038be88fb3561eebf28fa9975f2e1e63a8a0dbe4dc99f08df20eef2e5d51dfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Security for teleport-tap-sdk 0.1.1
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.