1# -*- coding: utf-8 -*-
2"""
3GRequests allows you to use Requests with Gevent to make asynchronous HTTP
4Requests easily.
5
6Usage
7-----
8
9Usage is simple:
10
11.. code-block:: python
12
13    import grequests
14
15    urls = [
16        'http://www.heroku.com',
17        'http://python-tablib.org',
18        'http://httpbin.org',
19        'http://python-requests.org',
20        'http://fakedomain/',
21        'http://kennethreitz.com'
22    ]
23
24Create a set of unsent Requests:
25
26.. code-block:: python
27
28    >>> rs = (grequests.get(u) for u in urls)
29
30Send them all at the same time:
31
32.. code-block:: python
33
34    >>> grequests.map(rs)
35    [<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, None, <Response [200]>]
36
37Optionally, in the event of a timeout or any other exception during the connection of
38the request, you can add an exception handler that will be called with the request and
39exception inside the main thread:
40
41.. code-block:: python
42
43    >>> def exception_handler(request, exception):
44    ...    print "Request failed"
45
46    >>> reqs = [
47    ...    grequests.get('http://httpbin.org/delay/1', timeout=0.001),
48    ...    grequests.get('http://fakedomain/'),
49    ...    grequests.get('http://httpbin.org/status/500')]
50    >>> grequests.map(reqs, exception_handler=exception_handler)
51    Request failed
52    Request failed
53    [None, None, <Response [500]>]
54
55
56Installation
57------------
58
59Installation is easy with pip::
60
61    $ pip install grequests
62
63"""
64
65from setuptools import setup
66
67setup(
68    name='grequests',
69    version='0.3.0',
70    url='https://github.com/kennethreitz/grequests',
71    license='BSD',
72    author='Kenneth Reitz',
73    author_email='me@kennethreitz.com',
74    description='Requests + Gevent',
75    long_description=__doc__,
76    install_requires=[
77        'gevent',
78        'requests'
79    ],
80    tests_require = ['nose'],
81    test_suite = 'nose.collector',
82    py_modules=['grequests'],
83    zip_safe=False,
84    include_package_data=True,
85    platforms='any',
86    classifiers=[
87        'Environment :: Web Environment',
88        'Intended Audience :: Developers',
89        'License :: OSI Approved :: BSD License',
90        'Operating System :: OS Independent',
91        'Programming Language :: Python',
92        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
93        'Topic :: Software Development :: Libraries :: Python Modules'
94    ]
95)
96