This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Requests Guard

.. image::

.. image::

.. image::
:alt: Documentation Status

requests-guard is a small library that allows you to impose size and time limits on your HTTP requests.

* Free software: BSD license
* Documentation:


* Timeout limits
* Size limits
* Much more!


Just use `pip` to install it:

pip install requests-guard

and you're done.


import requests
from requests_guard import guard

r = requests.get("", stream=True, timeout=30)
content = guard(r, max_size=3000, timeout=10)

`requests-guard` will raise a `ValueError` if it receives more than `max_size` data in total, or if the *entire*
request takes more than `timeout` seconds to be completed. That means that the call will always return after (roughly,
see below for details) `timeout` seconds.

*Note:* You *must* call requests in the manner above, with `stream=True` and `timeout`. `stream=True` allows the size
and time limits to be set, and the `timeout` parameter to `requests` instructs it to close the connection if no data
has been received for that number of seconds.

*Note:* `requests-guard` works by looking at the data as it receives it, so the `timeout` parameter to `requests-guard`
will apply to the *entire* connection, not just the latest chunk. The `timeout` parameter to `requests` means "quit if
we haven't received any data for that long", which means that a response may take an arbitrary amount of time, as long
as it always returns *something* every `timeout` seconds. This means that a request may potentially take up to the sum
of the timeout specified to `requests` and to `requests-guard`, if the server stops replying completely just before
the timeout in `requests-guard` elapses.


0.1.0 (2015-03-04)

* First release on PyPI.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
requests_guard-0.1.0-py2.py3-none-any.whl (4.9 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Mar 12, 2015
requests-guard-0.1.0.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Mar 12, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting