# from __future__ import absolute_import import errno import sys from evergreen import six from evergreen.lib.socket import socket, _fileobject from evergreen.lib.socket import error as socket_error, timeout as socket_timeout from evergreen.patcher import slurp_properties import ssl as __ssl__ __patched__ = ['SSLSocket', 'wrap_socket', 'sslwrap_simple'] slurp_properties(__ssl__, globals(), ignore=__patched__, srckeys=dir(__ssl__)) del slurp_properties _ssl = __ssl__._ssl if sys.version_info >= (2, 7): ssl_timeout_exc = SSLError else: ssl_timeout_exc = socket_timeout _SSLErrorReadTimeout = ssl_timeout_exc('The read operation timed out') _SSLErrorWriteTimeout = ssl_timeout_exc('The write operation timed out') _SSLErrorHandshakeTimeout = ssl_timeout_exc('The handshake operation timed out')
__all__ = __socket__.__all__ __patched__ = [ 'fromfd', 'socketpair', 'ssl', 'socket', 'SocketType', 'gethostbyname', 'gethostbyname_ex', 'getnameinfo', 'getaddrinfo', 'create_connection', ] slurp_properties(__socket__, globals(), ignore=__patched__, srckeys=dir(__socket__)) del slurp_properties if six.PY3: from socket import socket as __socket__socket__ # for ssl.py to create weakref class _realsocket(_socket.socket): pass class _fileobject: def __init__(self, sock, mode='rwb', bufsize=-1, close=False): super().__init__() self._sock = sock self._close = close
from functools import partial from operator import methodcaller from evergreen import futures, patcher # Monkey-patch. requests = patcher.import_patched('requests') __version__ = '0.0.1' __all__ = ['map', 'imap', 'get', 'options', 'head', 'post', 'put', 'patch', 'delete', 'request', '__version__'] # Export same items as vanilla requests __requests_imports__ = ['utils', 'session', 'Session', 'codes', 'RequestException', 'Timeout', 'URLRequired', 'TooManyRedirects', 'HTTPError', 'ConnectionError'] patcher.slurp_properties(requests, globals(), srckeys=__requests_imports__) __all__.extend(__requests_imports__) del requests, patcher, __requests_imports__ class AsyncRequest(object): """ Asynchronous request. Accept same parameters as ``Session.request`` and some additional: :param session: Session which will do the request, else one is created automatically. :param callback: Callback called on response. Same as passing ``hooks={'response': callback}``. """ def __init__(self, method, url, **kwargs): self.method = method self.url = url