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.4.tar.gz (83.2 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.4-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartsurge-0.0.4.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

Hashes for smartsurge-0.0.4.tar.gz
Algorithm Hash digest
SHA256 103da3d6f048412913c562e0cc1cfb3e95da591e476ca5709964e287cb16b4a6
MD5 cb4dc25fa2263aa4d2e0408dbd3bebe1
BLAKE2b-256 e1b9c4dcf679af73d998b28ca216511f894cb86e5f10bc96b03b502670659c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartsurge-0.0.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: smartsurge-0.0.4-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

Hashes for smartsurge-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a219104a2becae59da5f0a38db064fec45fda2eb23b1083f56fdd2f050aad07
MD5 63c7c8bff9b496f6643a29cad81e37c6
BLAKE2b-256 f8fec403f72874a74b61ed2ea0800604d0e9e4b8b7d6ad2542bbff6e7fdd9129

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartsurge-0.0.4-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