Enhanced Requests Library with Adaptive Rate Limit Estimation
Project description
SmartSurge: Enhanced Requests Library with Adaptive Rate Limit Estimation
SmartSurge is a Python library that enhances the functionality of the requests library with automatic rate limit detection and enforcement, using a statistically rigorous approach.
Features
- Automatic Rate Limit Detection: Automatically detects rate limits through a principled search procedure.
- Resumable Streaming Requests: Supports resumable streaming for large downloads.
- Comprehensive Logging: Detailed logging of request history and rate limit estimation.
- Async Support: Includes asynchronous request methods using aiohttp.
Installation
pip install smartsurge
Quick Start
from smartsurge import SmartSurgeClient
# Create a client
client = SmartSurgeClient(base_url="https://api.example.com")
# Make requests - SmartSurge will automatically detect and respect rate limits
response, history = client.get("/endpoint")
# Get the detected rate limit
rate_limit = history.rate_limit
print(f"Detected rate limit: {rate_limit}")
# Streaming requests with resumability
from smartsurge import JSONStreamingRequest
result, history = client.stream_request(
streaming_class=JSONStreamingRequest,
endpoint="/large-dataset",
state_file="download_state.json" # For resumability
)
Documentation
In progress.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smartsurge-0.0.3.tar.gz.
File metadata
- Download URL: smartsurge-0.0.3.tar.gz
- Upload date:
- Size: 83.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06c6fe45cc809fde9b4b6ab4d59ced94ffb8bf45e143671acbfa0d77d283a486
|
|
| MD5 |
0f577d737dd1f1963b5b040169f6c090
|
|
| BLAKE2b-256 |
fba8758949a25188dc9649f7809191941a95ff98b1bae53b64f1e6cf9a35d36a
|
Provenance
The following attestation bundles were made for smartsurge-0.0.3.tar.gz:
Publisher:
publish.yml on dingo-actual/smartsurge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartsurge-0.0.3.tar.gz -
Subject digest:
06c6fe45cc809fde9b4b6ab4d59ced94ffb8bf45e143671acbfa0d77d283a486 - Sigstore transparency entry: 211783568
- Sigstore integration time:
-
Permalink:
dingo-actual/smartsurge@a9ac95c9dbd0690ec9513682a2d441f84587fd50 -
Branch / Tag:
refs/tags/v0.0.3-alpha - Owner: https://github.com/dingo-actual
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9ac95c9dbd0690ec9513682a2d441f84587fd50 -
Trigger Event:
release
-
Statement type:
File details
Details for the file smartsurge-0.0.3-py3-none-any.whl.
File metadata
- Download URL: smartsurge-0.0.3-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
249ce631b563b83bdbcaa5ec6caa57fdb6abf07881ad3f491aedcd40d8e7dc26
|
|
| MD5 |
de01f04804352c80a3f07fed3d5245fb
|
|
| BLAKE2b-256 |
5f5498736c5cff70084e69ead3b88eeb677cd1426a2f752b8e91591ac75fc73f
|
Provenance
The following attestation bundles were made for smartsurge-0.0.3-py3-none-any.whl:
Publisher:
publish.yml on dingo-actual/smartsurge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartsurge-0.0.3-py3-none-any.whl -
Subject digest:
249ce631b563b83bdbcaa5ec6caa57fdb6abf07881ad3f491aedcd40d8e7dc26 - Sigstore transparency entry: 211783573
- Sigstore integration time:
-
Permalink:
dingo-actual/smartsurge@a9ac95c9dbd0690ec9513682a2d441f84587fd50 -
Branch / Tag:
refs/tags/v0.0.3-alpha - Owner: https://github.com/dingo-actual
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9ac95c9dbd0690ec9513682a2d441f84587fd50 -
Trigger Event:
release
-
Statement type: