Skip to main content

Use requests with gevent in your production

Project description

Gevent-Requests allows you to use Requests with Gevent to make asynchronous HTTP Requests easily. And this project also allow your own custom useage with gevent in your production environment, for example your can use it with flask like:

>>> from gevent import monkey
>>> monkey.patch_all(thread=False, select=False)

Usage

Usage is simple:

>>> # First patch the socket
>>> import gevent_requests

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

Create a set of unsent Requests:

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

Send them all at the same time:

>>> gevent_requests.gmap(rs)
[<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>]

Project details


Download files

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

Source Distribution

gevent_requests-0.6.1.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

gevent_requests-0.6.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page