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.3.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.3-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

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

Hashes for smartsurge-0.0.3.tar.gz
Algorithm Hash digest
SHA256 06c6fe45cc809fde9b4b6ab4d59ced94ffb8bf45e143671acbfa0d77d283a486
MD5 0f577d737dd1f1963b5b040169f6c090
BLAKE2b-256 fba8758949a25188dc9649f7809191941a95ff98b1bae53b64f1e6cf9a35d36a

See more details on using hashes here.

Provenance

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

Hashes for smartsurge-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 249ce631b563b83bdbcaa5ec6caa57fdb6abf07881ad3f491aedcd40d8e7dc26
MD5 de01f04804352c80a3f07fed3d5245fb
BLAKE2b-256 5f5498736c5cff70084e69ead3b88eeb677cd1426a2f752b8e91591ac75fc73f

See more details on using hashes here.

Provenance

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