aboutsummaryrefslogtreecommitdiff
path: root/requests/async.py
blob: ab04084f474100255227f81f1d2e7a13282fc1bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-

"""
    requests.async
    ~~~~~~~~~~~~~~

    This module implements the main Requests system, after monkey-patching
    the urllib2 module with eventlet or gevent..

    :copyright: (c) 2011 by Kenneth Reitz.
    :license: ISC, see LICENSE for more details.
"""


from __future__ import absolute_import

import urllib
import urllib2

from urllib2 import HTTPError


try:
    import eventlet
    eventlet.monkey_patch()
except ImportError:
    pass

if not 'eventlet' in locals():
    try:
        from gevent import monkey
        monkey.patch_all()
    except ImportError:
        pass


if not 'eventlet' in locals():
    raise ImportError('No Async adaptations of urllib2 found!')


from .core import *