Skip to main content

A ratelimiting Session adapter for requests.

Project description


pypi version Travis Status Documentation Status

A ratelimiting Session adapter for requests.


>>> from requests_ratelimit_adapter import HTTPRateLimitAdapter
>>> import requests
>>> import time

>>> # Create a rate limiting adapter
>>> rate_limiter = HTTPRateLimitAdapter(calls=1, period=1)

>>> s = requests.Session()
>>> s.mount("https://", rate_limiter)

>>> # This first request will start the period.
>>> r = s.get("")
>>> r.raise_for_status()
>>> time1 = time.time()

>>> # This second request will wait 1 second before executing.
>>> r2 = s.get("")
>>> r2.raise_for_status()
>>> time2 = time.time()

>>> # For this example, verify the timestamps are more than a second apart.
>>> assert time2 >= time1 + 1


This package was created with Cookiecutter and the cmeister2/cookiecutter-pypackage project template.


All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.



0.2.0 - 2019-01-06


  • Wrap the HTTPAdapter code from requests so there's less boilerplate.

0.1.2 - 2018-12-24


  • Use the correct travis password for deploying to PyPI.

0.1.1 - 2018-12-24


  • Add travis password for deploying to PyPI.

0.1.0 - 2018-12-24


  • Initial commit of code.

Project details

Download files

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

Files for requests-ratelimit-adapter, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size requests_ratelimit_adapter-0.2.0-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size requests_ratelimit_adapter-0.2.0.tar.gz (10.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page