API endpoints are often paginated, meaning that you must chain requests to get the content in full. Unpaginate provides a decorator to make that task easy:
>>> from unpaginate import unpaginate
>>> @unpaginate
... def get_cities(pagination, country):
... return requests.post(
... "https://api.example.org/cities",
... json={"country": country, "page": pagination.page},
... ).json()["items"]
Calling the decorated function allows to iterate over all items of all pages:
>>> iterator = get_cities("France") # the 'pagination' parameter is added by the decorator
>>> iterator
<generator object get_cities ...>
>>> next(iterator)
'Paris'
>>> next(iterator)
'Lyon'
>>> next(iterator)
'Marseille'
All pagination schemes are supported:
- By page index
- By offset
- Using a cursor
- Other schemes through avdanced mode
Metadata
Release files for unpaginate 0.1.0
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 |
|---|---|---|---|---|
| unpaginate-0.1.0.tar.gz | 20.1 kB | Without provenance | Details for unpaginate-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unpaginate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for unpaginate-0.1.0-py3-none-any.whl |
Total release size: 28.4 kB
Release files / unpaginate-0.1.0.tar.gz
| Download URL | unpaginate-0.1.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a40db65bfed0be43a3f5bddd259d58b484359db84a34322a1b946953bd5f158c
|
|
BLAKE2b-256 checksum How to use checksums |
30b1e907f33a94c1f2d8ae62f2bc1d515b09432379748665dfea735fae2714eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / unpaginate-0.1.0-py3-none-any.whl
| Download URL | unpaginate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbcaf68df41ea78a5bb569989c74464e499af234e4ba8462b7f9bec8afcec6d9
|
|
BLAKE2b-256 checksum How to use checksums |
547d181e00f6abfe1361db15074fe39bbd69fe336760cf69e5defa513ccccd8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for unpaginate 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.
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.