Skip to main content

RequestsThrottler: HTTP requests throttler

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

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:

import requests
from requests_throttler import BaseThrottler

bt = BaseThrottler(name='base-throttler', delay=1.5)
request = requests.Request(method='GET', url='http://www.google.com')
reqs = [request for i in range(0, 5)]

bt.start()
throttled_requests = bt.multi_submit(reqs)
bt.shutdown()

responses = [tr.response for tr in throttled_requests]

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

import requests
from requests_throttler import BaseThrottler

with BaseThrottler(name='base-throttler', delay=1.5) as bt:
    request = requests.Request(method='GET', url='http://www.google.com')
    reqs = [request for i in range(0, 5)]
    throttled_requests = bt.multi_submit(reqs)

responses = [tr.response for tr in throttled_requests]

Installation

Use pip to install RequestsThrottler:

$ pip install RequestsThrottler

Features

  • BaseThrottler a simple throttler with a fixed amount of delay

Release History

0.2.5 (2019-02-18)

  • Unpinned deps in setup.py

0.2.4 (2014-07-13)

  • Fixed wrong request preparation (thanks to bleedinge for reporting the problem)

0.2.3 (2014-02-16)

  • Fixed installation via pip (thanks to Gavin D'mello for reporting the problem)

0.2.2 (2014-01-15)

  • Added possibility to use a user-defined session when using BaseThrottler
  • Fixed example, updated README

0.2.1 (2014-01-14)

  • Added implicit way to set delay for BaseThrottler by using reqs_over_time

0.2.0 (2014-01-04)

  • Reorganized modules
  • Changed submit method signature in favor of two methods: submit and multi_submit
  • Added documentation

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

Metadata

Release files for RequestsThrottler 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RequestsThrottler 0.2.5
File Size Uploaded
RequestsThrottler-0.2.5.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for RequestsThrottler 0.2.5
File Interpreter ABI Platform
RequestsThrottler-0.2.5-py2-none-any.whl Python 2 none any Details

Total release size: 30.0 kB

Release files / RequestsThrottler-0.2.5.tar.gz

Download URL RequestsThrottler-0.2.5.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dabba1fc94353199ba61541b58462012388f445ffc0f89f25856739ad544e395
BLAKE2b-256 checksum
How to use checksums
d3f3a7e9e051f356c3b412bcb139ebbb26e5750be2d6af7c64aa495d125787b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release files / RequestsThrottler-0.2.5-py2-none-any.whl

Download URL RequestsThrottler-0.2.5-py2-none-any.whl
Size 16.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
c25cf05be5ecceb624d4e6d65d621d764d9385a027613dae4847d4fc67126680
BLAKE2b-256 checksum
How to use checksums
023eb855f66645325147fd0e81bdca64ded6f61b7d0e962a8d24e8f64b93c7ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page