apifetch (Python)
apifetch is a small, dependency-light toolkit for talking to
token-authenticated REST APIs. It handles three recurring chores:
- Token management — store/get/remove/list tokens in process environment variables (never written to disk), namespaced per service.
- Request building — pluggable authentication and pagination
strategies, bundled into a reusable
Apiprofile. - Data retrieval — fetch one page, or fetch everything in chunks.
This is the Python sibling of the R package
apifetch. Both were extracted
from the BigDataPE package,
which is now one use case (see examples/bigdatape.py).
Installation
pip install apifetch
Usage
import apifetch as af
# 1. Describe the API once: where, how to authenticate, how to paginate.
api = af.Api(
endpoint="https://api.example.com/v1/search",
service="Example",
auth=af.AuthBearer(), # "Authorization: Bearer <token>"
pagination=af.PaginateOffset(where="query"),
)
# 2. Store a token (kept only in this process's environment).
af.store_token("reports", "my-secret-token", service="Example")
# 3. Fetch.
one_page = af.fetch(api, "reports", limit=50)
everything = af.fetch_all(api, "reports", chunk_size=1000)
# Optional: turn it into a DataFrame.
# import pandas as pd; df = pd.DataFrame(everything)
Strategies
Authentication: AuthBearer, AuthRaw, AuthHeader, AuthQuery.
Pagination: PaginateOffset(where="header" | "query"), PaginateNone.
License
MIT © André Leite
Release files for apifetch 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apifetch-0.1.3.tar.gz | 50.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apifetch-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.4 kB
Release files / apifetch-0.1.3.tar.gz
| Download URL | apifetch-0.1.3.tar.gz |
|---|---|
| Size | 50.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c76dcb6e2076022ff264681cd09e619fce1f8954c7907169db64a4deb920070
|
|
BLAKE2b-256 checksum How to use checksums |
f348ddb7b5bcf835af297898376877e31fae3d14473963dac45fbab2a369e2f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 14, 2026.
Transparency logRelease files / apifetch-0.1.3-py3-none-any.whl
| Download URL | apifetch-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9845f2ca8fb2604fd50a844c27aa95294e1819ac9cfef4608845dcf8d7a0bd27
|
|
BLAKE2b-256 checksum How to use checksums |
e27511c0818d313ab069aad9237936d6f496893010c202d2f79bcd53fc3ebe6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 14, 2026.
Transparency log