Skip to main content

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


Download files

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

Source Distribution

smartsurge-0.0.1.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smartsurge-0.0.1-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file smartsurge-0.0.1.tar.gz.

File metadata

  • Download URL: smartsurge-0.0.1.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for smartsurge-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c493894fbc5646a0b208150af42bbbc7a258eaef026d738791dcde620158e73d
MD5 9c0b7c195393827d493e34ecc87ed3d3
BLAKE2b-256 7b04cc621caee7298e030c4d17c9f4e86e7511c88ec3765ee9ad6d26742a0f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartsurge-0.0.1.tar.gz:

Publisher: publish.yml on dingo-actual/smartsurge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smartsurge-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: smartsurge-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for smartsurge-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f918da0cb9175df01513d01145957d33b4eebd41047cc63d2b838d48efb4439b
MD5 7e55d58e8547fbaf1489270b2abf6e11
BLAKE2b-256 4cc5bdfc9e7255fc557fca5f10b8690ce277351381c4a225f558f216324976aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartsurge-0.0.1-py3-none-any.whl:

Publisher: publish.yml on dingo-actual/smartsurge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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