Skip to main content

requests-wrapper

Code quality checks Status
CodeFactor Codefactor
Github Workflows GithubWorkflows
Codecov codecov

This repo is a wrapper programme based python's requests package, adding a simple API key management capability.

It is designed to:

  • Enable calling API endpoints using multiple API keys
  • So that different API keys can be used for each consecutive call
  • This can potentially benefit in cases where each API key is rate limiting
  • When the rate limit is specified, this wrapper will automatically sleep accordingly until the API key can be used again, reducing the chance of getting a bad 429 Too Many Requests error code

Installation

pip install requests-wrapper

Example

from requests_wrapper.requests_wrapper import RequestsWrapper

# Load API keys, api_key_header and rate limit when constructing the class instance
requests_wrapper = RequestsWrapper(
    api_keys=["<api_key1>", "<api_key2>"],
    api_key_header="Authorization",
    call_limit_per_second=2
)

queries = ["search_term1", "search_term2", "search_term3"]
responses = []

for query in queries:

    # Calling this is almost the same as calling requests, 
    # with the addition of specifying the http_method 
    response = requests_wrapper.call(
        http_method="get",
        url="<my_url>",
        params={"q": query}
    )

    responses.append(response)

Metadata

Release files for requests-wrapper 0.0.3

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

Source distribution (sdist)

Source distribution for requests-wrapper 0.0.3
File Size Uploaded Provenance
requests_wrapper-0.0.3.tar.gz 3.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-wrapper 0.0.3
File Interpreter ABI Platform
requests_wrapper-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / requests_wrapper-0.0.3.tar.gz

Download URL requests_wrapper-0.0.3.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e59a50d9993b66d3204904152440cd3629dea689197a5cf03038ff4bcebeb389
BLAKE2b-256 checksum
How to use checksums
29e09e95e15964645693a2221831d34c1e089c71ca2f96edebdec8797808cb3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / requests_wrapper-0.0.3-py3-none-any.whl

Download URL requests_wrapper-0.0.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0813c9bb8bd16c05741abf325dcb9af2e971676e2acdd94f0cf345021e473394
BLAKE2b-256 checksum
How to use checksums
c37c70ab7a0e5e4a37dae0e361ccc1261f981a6702871f26e3109668c544e2cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for requests-wrapper 0.0.3

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.

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