New upstream release.
Kali Janitor
2 years ago
|
0 |
include LICENSE
|
|
1 |
include README.rst
|
2 | 2 |
|
3 | 3 |
GRequests allows you to use Requests with Gevent to make asynchronous HTTP
|
4 | 4 |
Requests easily.
|
|
5 |
|
|
6 |
|version| |pyversions|
|
|
7 |
|
5 | 8 |
|
6 | 9 |
**Note**: You should probably use `requests-threads <https://github.com/requests/requests-threads>`_ or `requests-futures <https://github.com/ross/requests-futures>`_ instead.
|
7 | 10 |
|
|
44 | 47 |
.. code-block:: python
|
45 | 48 |
|
46 | 49 |
>>> def exception_handler(request, exception):
|
47 | |
... print "Request failed"
|
|
50 |
... print("Request failed")
|
48 | 51 |
|
49 | 52 |
>>> reqs = [
|
50 | 53 |
... grequests.get('http://httpbin.org/delay/1', timeout=0.001),
|
|
64 | 67 |
|
65 | 68 |
$ pip install grequests
|
66 | 69 |
✨🍰✨
|
|
70 |
|
|
71 |
|
|
72 |
.. |version| image:: https://img.shields.io/pypi/v/grequests.svg?colorB=blue
|
|
73 |
:target: https://pypi.org/project/grequests/
|
|
74 |
|
|
75 |
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/grequests.svg?
|
|
76 |
:target: https://pypi.org/project/grequests/
|
|
0 |
python-grequests (0.6.0-0kali1) UNRELEASED; urgency=low
|
|
1 |
|
|
2 |
* New upstream release.
|
|
3 |
|
|
4 |
-- Kali Janitor <[email protected]> Thu, 03 Jun 2021 04:27:53 -0000
|
|
5 |
|
0 | 6 |
python-grequests (0.4.0-0kali1) kali-dev; urgency=medium
|
1 | 7 |
|
2 | 8 |
* Initial release
|
9 | 9 |
"""
|
10 | 10 |
from functools import partial
|
11 | 11 |
import traceback
|
|
12 |
|
12 | 13 |
try:
|
13 | 14 |
import gevent
|
14 | 15 |
from gevent import monkey as curious_george
|
|
20 | 21 |
curious_george.patch_all(thread=False, select=False)
|
21 | 22 |
|
22 | 23 |
from requests import Session
|
23 | |
|
24 | 24 |
|
25 | 25 |
__all__ = (
|
26 | 26 |
'map', 'imap',
|
|
46 | 46 |
self.session = kwargs.pop('session', None)
|
47 | 47 |
if self.session is None:
|
48 | 48 |
self.session = Session()
|
|
49 |
self._close = True
|
|
50 |
else:
|
|
51 |
self._close = False # don't close adapters after each request if the user provided the session
|
49 | 52 |
|
50 | 53 |
callback = kwargs.pop('callback', None)
|
51 | 54 |
if callback:
|
|
72 | 75 |
except Exception as e:
|
73 | 76 |
self.exception = e
|
74 | 77 |
self.traceback = traceback.format_exc()
|
|
78 |
finally:
|
|
79 |
if self._close:
|
|
80 |
# if we provided the session object, make sure we're cleaning up
|
|
81 |
# because there's no sense in keeping it open at this point if it wont be reused
|
|
82 |
self.session.close()
|
75 | 83 |
return self
|
76 | 84 |
|
77 | 85 |
|
|
122 | 130 |
ret.append(request.response)
|
123 | 131 |
elif exception_handler and hasattr(request, 'exception'):
|
124 | 132 |
ret.append(exception_handler(request, request.exception))
|
|
133 |
elif exception_handler and not hasattr(request, 'exception'):
|
|
134 |
ret.append(exception_handler(request, None))
|
125 | 135 |
else:
|
126 | 136 |
ret.append(None)
|
127 | 137 |
|
32 | 32 |
|
33 | 33 |
setup(
|
34 | 34 |
name='grequests',
|
35 | |
version='0.4.0',
|
|
35 |
version='0.6.0',
|
36 | 36 |
url='https://github.com/kennethreitz/grequests',
|
37 | 37 |
license='BSD',
|
38 | 38 |
author='Kenneth Reitz',
|