diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:15 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:15 -0700 |
commit | 4fad8c1375c73a3d4483fe78e4534c7dabc453f5 (patch) | |
tree | cd9f3e8c6811892a2cea932b9d1d97b41945b712 /requests/async.py | |
download | python-requests-4fad8c1375c73a3d4483fe78e4534c7dabc453f5.tar python-requests-4fad8c1375c73a3d4483fe78e4534c7dabc453f5.tar.gz |
Imported Upstream version 0.4.1
Diffstat (limited to 'requests/async.py')
-rw-r--r-- | requests/async.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/requests/async.py b/requests/async.py new file mode 100644 index 0000000..ab04084 --- /dev/null +++ b/requests/async.py @@ -0,0 +1,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 * |