Skip to main content

Python HTTP requests throttler

Project description

RequestsThrottler is an Apache2 Licensed HTTP library, written in Python, and powered by futures and Requests.

With RequestsThrottler you can easily throttle HTTP requests! After having created your throttler with a delay of your choice, you just have to:

  1. Start the throttler

  2. Submit your requests

  3. Shutdown the throttler

Here’s an example:

bt = BaseThrottler(name='base-throttler', delay=1.5)
request = requests.Request(method='GET', url='http://www.google.com')

bt.start()
throttled_request = bt.submit(request)
bt.shutdown()

response = throttled_request.response

Too hard? Then just submit your requests inside a with statement! Here’s an example:

with BaseThrottler(name='base-throttler', delay=1.5):
    request = requests.Request(method='GET', url='http://www.google.com')
    throttled_request = bt.submit(request)

response = throttled_request.response

Try also the example.py by running:

>>> python example.py

Installation

Use pip to install RequestsThrottler:

>>> pip install RequestsThrottler

Features

  • BaseThrottler a simple throttler with a fixed amount of delay

Release History

0.1.1 (2013-12-31)

  • Fixed not working previous release

  • Changed example.py

0.1.0 (2013-12-30)

  • BaseThrottler a simple throttler with a fixed amount of delay

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

RequestsThrottler-0.1.1.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file RequestsThrottler-0.1.1.tar.gz.

File metadata

File hashes

Hashes for RequestsThrottler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00c138e51cecde9672e64d4d74edbce130a15fecb7a51d6f3d0ece4df68627c3
MD5 5bfed774895cdbeaf00ac4c46727d4a0
BLAKE2b-256 0cefac8a830a8177fcdf865547d67272f2bd34b247b4f65f81a1f8bd77ee43df

See more details on using hashes here.

Supported by

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