Metadata-Version: 2.1
Name: requests-ratelimit-adapter
Version: 0.1.2
Summary: A ratelimiting Session adapter for requests.
Home-page: https://github.com/cmeister2/requests_ratelimit_adapter
Author: Max Dymond
Author-email: cmeister2@gmail.com
License: MIT license
Keywords: requests_ratelimit_adapter
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Requires-Dist: requests

# requests-ratelimit-adapter

[![pypi version](https://img.shields.io/pypi/v/requests_ratelimit_adapter.svg)](https://pypi.python.org/pypi/requests_ratelimit_adapter)
[![Travis Status](https://img.shields.io/travis/cmeister2/requests_ratelimit_adapter.svg)](https://travis-ci.org/cmeister2/requests_ratelimit_adapter)
[![Documentation Status](https://readthedocs.org/projects/requests-ratelimit-adapter/badge/?version=latest)](https://requests-ratelimit-adapter.readthedocs.io/en/latest/?badge=latest)

A ratelimiting Session adapter for requests.

- Free software: MIT license
- Documentation: https://requests-ratelimit-adapter.readthedocs.io.

## Example

    >>> from requests_ratelimit_adapter import RateLimitAdapter
    >>> from requests.adapters import HTTPAdapter
    >>> import requests
    >>> import time

    >>> # Create an HTTP adapter.
    >>> http = HTTPAdapter()

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

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

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

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

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


## Credits

This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [cmeister2/cookiecutter-pypackage](https://github.com/cmeister2/cookiecutter-pypackage) project template.


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

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed

## [0.1.2] - 2018-12-24
### Changed
- Use the *correct* travis password for deploying to PyPI.

## [0.1.1] - 2018-12-24
### Added
- Add travis password for deploying to PyPI.

## [0.1.0] - 2018-12-24
### Added
- Initial commit of code.

[Unreleased]: https://github.com/cmeister2/requests_ratelimit_adapter/compare/v0.1.2...HEAD
[0.1.2]: https://github.com/cmeister2/requests_ratelimit_adapter/compare/v0.1.0...v0.1.2
[0.1.1]: https://github.com/cmeister2/requests_ratelimit_adapter/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/cmeister2/requests_ratelimit_adapter/tree/v0.1.0


