Skip to main content

repsapi

Official Python client for the RepsApi.pl API: parcel tracking, warehouse QC photos, product lookup, agent links, shipping estimates and haul calculations.

  • Sync (RepsApi) and async (AsyncRepsApi) clients, e.g. for discord.py bots.
  • Typed responses (TypedDict), so your editor completes every field.
  • Retries network errors, 5xx answers and short rate limits on its own.
  • One dependency: httpx. Python 3.9+.

Install

pip install repsapi

Quick start

Create an API key in the dashboard and put it in the REPSAPI_KEY environment variable (or pass it as api_key).

from repsapi import RepsApi

with RepsApi() as api:  # reads REPSAPI_KEY
    parcel = api.tracking("YT2530998211074512")
    if parcel["summary"]:
        print(parcel["summary"]["status_en"])

    item = api.lookup("https://weidian.com/item.html?itemID=7779617259", currency="PLN")
    print(item["title_en"], item.get("price_local"))

Async:

import asyncio
from repsapi import AsyncRepsApi

async def main():
    async with AsyncRepsApi() as api:
        qc = await api.qc(platform="weidian", id="7779617259")
        print(qc["total_photos"])

asyncio.run(main())

Responses are the API's JSON as plain dicts. Field-by-field descriptions are in the documentation.

Methods

Every method also takes timeout= (seconds) and max_retries=.

Method API Key
tracking(number) GET /v1/tracking yes
qc(url) / qc(platform=, id=) GET /v1/qc yes
lookup(url, currency=, agent=) / lookup(platform=, id=, ...) GET /v1/lookup yes
convert(url, agents=) GET /v1/convert yes
shipping_estimate(country, weight=, dimensions=, urls=, currency=, battery=, brands=, liquids=) POST /v1/shipping/estimate yes
haul(items, country, currency=, battery=, brands=, liquids=) POST /v1/haul yes
usage() GET /v1/usage yes
shipping_countries() GET /v1/shipping/countries no
rates(base="CNY") GET /v1/rates no
health(days=) GET /v1/health no
changelog(limit=, lang=) GET /v1/changelog no
# the same product on two agents
links = api.convert("https://detail.1688.com/offer/678091425228.html", agents=["kakobuy", "cnfans"])
print(links["agents"]["kakobuy"])

# shipping lines for a 1.2 kg parcel to Poland, priced in PLN
estimate = api.shipping_estimate("PL", weight=1200, currency="PLN")
print(estimate["cheapest"])

# a whole haul
haul = api.haul(
    [
        {"url": "https://weidian.com/item.html?itemID=7779617259", "quantity": 2},
        {"url": "https://detail.1688.com/offer/678091425228.html"},
    ],
    "PL",
    currency="PLN",
)
print(haul["totals"].get("local"))

Errors

Every error extends RepsApiError. Errors from the API extend APIError and carry status, type (the API's error type), message and details (extra fields such as allowed).

Class When
BadRequestError 400 / 413 / 415: something in the request is wrong
AuthenticationError 401: missing, invalid or revoked key
PermissionDeniedError 403: the key lacks this API's scope, or the IP isn't whitelisted
UnprocessableEntityError 422: no platform and product id in the link
RateLimitError 429: has retry_after (seconds), reset_at, limit, used, scope
InternalServerError 5xx
APIConnectionError / APITimeoutError no answer at all
from repsapi import RateLimitError, UnprocessableEntityError

try:
    api.lookup(link)
except RateLimitError as err:
    print("Quota used up, resets", err.reset_at)
except UnprocessableEntityError:
    print("That isn't a product link.")

Retries, timeouts and limits

  • Network errors and 500/502/503/504 answers are retried twice with a growing pause (max_retries).
  • A 429 is retried after its Retry-After when that is at most 60 s (max_retry_wait); a used-up daily quota raises RateLimitError at once.
  • Failed calls don't count toward your quota, so retries cost nothing.
  • Timeouts: 60 s, hauls and link-based shipping estimates 180 s (timeout).
  • api.rate_limit holds the per-minute limit from the last response that carried one.
  • The client never follows redirects, so your key is never sent anywhere but base_url, and base_url must be https://. repr(api) never shows the key.
api = RepsApi(api_key="rk_live_...", timeout=30, max_retries=3)

Changelog

0.1.1 (2026-10-14): ServiceName includes "shipping" - health() now reports the shipping calculator. No runtime changes.

0.1.0 (2026-10-14): first release. The full list is in CHANGELOG.md in the source distribution.

License

MIT

Metadata

Release files for repsapi 0.1.1

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

Source distribution (sdist)

Source distribution for repsapi 0.1.1
File Size Uploaded Provenance Actions
repsapi-0.1.1.tar.gz 15.7 kB Without provenance Details for repsapi-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 32.2 kB

Release files / repsapi-0.1.1.tar.gz

Download URL repsapi-0.1.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
80591479096f75e04ce24c9c49056749cc59e1ab714db9a77318e12d8721f6c7
BLAKE2b-256 checksum
How to use checksums
f62952e21c3598264a7acfccb4d9e2f7ffd9a5c1c6c57f09d6bc076cec52bcd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / repsapi-0.1.1-py3-none-any.whl

Download URL repsapi-0.1.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06d7a8ff3e04dea39c74cc796c50c447f77b9366ec376292753aa26c9bb079bf
BLAKE2b-256 checksum
How to use checksums
b0f892aa20b616fe6b803cb4b07afc8b29f3c75f9182301ad43d3c10d6016c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for repsapi 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.

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