Skip to main content

paginateit

Python application made-with-python Maintenance PyPI - Downloads PyPI pyversions

Used to paginate REST API Calls / Mostly on MultiThreaded API Calls via Python

Description

Takes 2 inputs:

  • count -> total number of items in all pages
  • max_workers -> number of threads need to be created (Based upon the number provided, skip and limits are calculated dynamically)

Getting Started

Dependencies

Python 3.6 and further releases.

Installing

pip install paginateit

Executing program

from paginateit import paginateit as pg
pg.page(23052, 4)

----------------|---------------|---------------|------------|
|SKIP           | LIMIT         | FLIMIT        | COUNT      |
|---------------|---------------|---------------|------------|
|skip1: 0       |limit1: 5763	|flimit1: 763	|count1: 5763|
|---------------|---------------|---------------|------------|
|skip2: 5763	|limit2: 11526	|flimit2: 1526	|count2: 5763|
|---------------|---------------|---------------|------------|
|skip3: 11526	|limit3: 17289	|flimit3: 7289	|count3: 5763|
|---------------|---------------|---------------|------------|
|skip4: 17289	|limit4: 23052	|flimit4: 3052	|count4: 5763|
|---------------|---------------|---------------|------------|
|skip5: 23052	|limit5: 28815	|flimit5: 8815	|count5: 5763|
|---------------|---------------|---------------|------------|

We can now use the variables like skip(x) or limit(x) in the API where filter.

SKIP: A skip filter omits the specified number of returned records
LIMIT: A limit filter limits the number of records returned to the specified number
FLIMIT (Custome field): A flimit filter can be used to fetch all the remaining records at the last page of every thread
COUNT: A count filter tell the maximum number of records available in that page.

Other examples:

pg.page(1700, 8) --> Max records availabe in all pages is 1700 and are creating 8 threads / loops (We see skip[1-9] values)
pg.page(90005, 6) --> Max records availabe in all pages is 90005 and are creating 6 threads / loops (We see skip[1-7] values)
pg.page(5025) --> Max records availabe in all pages is 1700 and are creating 8 threads /loops (We see skip[1-3] values)

pg.page(count, max_workers) # max_workers defaults to 2 unless specified

Usage

Access the dynamic calculated variables as shown below:

pg.skip1, pg.skip3, pg.limit2, pg.flimit4, pg.count2

Help

Any advise for common problems or issues, please feel free to create a issue in Github

Authors

Manjesh N manjesh_n@hotmail.com

License

This project is licensed under the Apache License 2.0 License - see the LICENSE file for details

Acknowledgments

Release files for paginateit 1.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 paginateit 1.1.1
File Size Uploaded
paginateit-1.1.1.tar.gz 3.5 kB Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / paginateit-1.1.1.tar.gz

Download URL paginateit-1.1.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
199eb18db76bf2c923364dbe664da9c4da19908fb1593d9aa8feb3324ecbd568
BLAKE2b-256 checksum
How to use checksums
46fc7b88e4958983b44f18f2b93ddbf58ab052bbae7b28178206c4a8d7f31a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / paginateit-1.1.1-py3-none-any.whl

Download URL paginateit-1.1.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce681553e88701822a62b7f96524e9fa90a2e166c50dcbbf1a70904e419e26a3
BLAKE2b-256 checksum
How to use checksums
c33f0771a767ea18999e9f10ec819ff49787f16de0080500cfee8eb0cc0ef322
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

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