Skip to main content

GRequests allows you to use Requests with Gevent to make asynchronous HTTP Requests easily.

Usage

Usage is simple:

import grequests

urls = [
    'http://www.heroku.com',
    'http://python-tablib.org',
    'http://httpbin.org',
    'http://python-requests.org',
    'http://fakedomain/',
    'http://kennethreitz.com'
]

Create a set of unsent Requests:

>>> rs = (grequests.get(u) for u in urls)

Send them all at the same time:

>>> grequests.map(rs)
[<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, None, <Response [200]>]

Optionally, in the event of a timeout or any other exception during the connection of the request, you can add an exception handler that will be called with the request and exception inside the main thread:

>>> def exception_handler(request, exception):
...    print "Request failed"

>>> reqs = [
...    grequests.get('http://httpbin.org/delay/1', timeout=0.001),
...    grequests.get('http://fakedomain/'),
...    grequests.get('http://httpbin.org/status/500')]
>>> grequests.map(reqs, exception_handler=exception_handler)
Request failed
Request failed
[None, None, <Response [500]>]

Installation

Installation is easy with pip:

$ pip install grequests

Metadata

Release files for grequests 0.3.0

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

Source distribution (sdist)

Source distribution for grequests 0.3.0
File Size Uploaded Provenance Actions
grequests-0.3.0.tar.gz 3.5 kB Without provenance Details for grequests-0.3.0.tar.gz

Release files / grequests-0.3.0.tar.gz

Download URL grequests-0.3.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0f41c4eee83bab39f5543af49665c08681637a0562a5704a3f7b2e4a996531c9
BLAKE2b-256 checksum
How to use checksums
259fdff6f21676ca5d3e806e60cf0a49c52eb8f8c859310d28b1e740bc49b93e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for grequests 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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