Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paginateit-1.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

paginateit-1.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file paginateit-1.1.1.tar.gz.

File metadata

  • Download URL: paginateit-1.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for paginateit-1.1.1.tar.gz
Algorithm Hash digest
SHA256 199eb18db76bf2c923364dbe664da9c4da19908fb1593d9aa8feb3324ecbd568
MD5 d44087abf355aad33d07c7d69ef6b733
BLAKE2b-256 46fc7b88e4958983b44f18f2b93ddbf58ab052bbae7b28178206c4a8d7f31a01

See more details on using hashes here.

File details

Details for the file paginateit-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: paginateit-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for paginateit-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce681553e88701822a62b7f96524e9fa90a2e166c50dcbbf1a70904e419e26a3
MD5 3ee2c51279f0344fe3f88614aceedcba
BLAKE2b-256 c33f0771a767ea18999e9f10ec819ff49787f16de0080500cfee8eb0cc0ef322

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page