mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Update Requests library to 2.7.0 (5d6d1bc).
This commit is contained in:
parent
980afb7298
commit
5cf79fb3b9
6 changed files with 26 additions and 21 deletions
|
@ -19,6 +19,7 @@
|
||||||
* Change configure quiet option in Hachoir to suppress warnings (add ref:hacks.txt)
|
* Change configure quiet option in Hachoir to suppress warnings (add ref:hacks.txt)
|
||||||
* Add parse media content to determine quality before making final assumptions during re-scan, update, pp
|
* Add parse media content to determine quality before making final assumptions during re-scan, update, pp
|
||||||
* Add a postprocess folder name validation
|
* Add a postprocess folder name validation
|
||||||
|
* Update Requests library to 2.7.0 (5d6d1bc)
|
||||||
|
|
||||||
|
|
||||||
### 0.10.0 (2015-08-06 11:05:00 UTC)
|
### 0.10.0 (2015-08-06 11:05:00 UTC)
|
||||||
|
|
|
@ -35,6 +35,7 @@ from .auth import _basic_auth_str
|
||||||
DEFAULT_POOLBLOCK = False
|
DEFAULT_POOLBLOCK = False
|
||||||
DEFAULT_POOLSIZE = 10
|
DEFAULT_POOLSIZE = 10
|
||||||
DEFAULT_RETRIES = 0
|
DEFAULT_RETRIES = 0
|
||||||
|
DEFAULT_POOL_TIMEOUT = None
|
||||||
|
|
||||||
|
|
||||||
class BaseAdapter(object):
|
class BaseAdapter(object):
|
||||||
|
@ -326,8 +327,8 @@ class HTTPAdapter(BaseAdapter):
|
||||||
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
|
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
|
||||||
:param stream: (optional) Whether to stream the request content.
|
:param stream: (optional) Whether to stream the request content.
|
||||||
:param timeout: (optional) How long to wait for the server to send
|
:param timeout: (optional) How long to wait for the server to send
|
||||||
data before giving up, as a float, or a (`connect timeout, read
|
data before giving up, as a float, or a :ref:`(connect timeout,
|
||||||
timeout <user/advanced.html#timeouts>`_) tuple.
|
read timeout) <timeouts>` tuple.
|
||||||
:type timeout: float or tuple
|
:type timeout: float or tuple
|
||||||
:param verify: (optional) Whether to verify SSL certificates.
|
:param verify: (optional) Whether to verify SSL certificates.
|
||||||
:param cert: (optional) Any user-provided SSL certificate to be trusted.
|
:param cert: (optional) Any user-provided SSL certificate to be trusted.
|
||||||
|
@ -375,7 +376,7 @@ class HTTPAdapter(BaseAdapter):
|
||||||
if hasattr(conn, 'proxy_pool'):
|
if hasattr(conn, 'proxy_pool'):
|
||||||
conn = conn.proxy_pool
|
conn = conn.proxy_pool
|
||||||
|
|
||||||
low_conn = conn._get_conn(timeout=timeout)
|
low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
low_conn.putrequest(request.method,
|
low_conn.putrequest(request.method,
|
||||||
|
@ -407,9 +408,6 @@ class HTTPAdapter(BaseAdapter):
|
||||||
# Then, reraise so that we can handle the actual exception.
|
# Then, reraise so that we can handle the actual exception.
|
||||||
low_conn.close()
|
low_conn.close()
|
||||||
raise
|
raise
|
||||||
else:
|
|
||||||
# All is well, return the connection to the pool.
|
|
||||||
conn._put_conn(low_conn)
|
|
||||||
|
|
||||||
except (ProtocolError, socket.error) as err:
|
except (ProtocolError, socket.error) as err:
|
||||||
raise ConnectionError(err, request=request)
|
raise ConnectionError(err, request=request)
|
||||||
|
|
|
@ -27,8 +27,8 @@ def request(method, url, **kwargs):
|
||||||
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': ('filename', fileobj)}``) for multipart encoding upload.
|
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': ('filename', fileobj)}``) for multipart encoding upload.
|
||||||
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
|
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
|
||||||
:param timeout: (optional) How long to wait for the server to send data
|
:param timeout: (optional) How long to wait for the server to send data
|
||||||
before giving up, as a float, or a (`connect timeout, read timeout
|
before giving up, as a float, or a :ref:`(connect timeout, read
|
||||||
<user/advanced.html#timeouts>`_) tuple.
|
timeout) <timeouts>` tuple.
|
||||||
:type timeout: float or tuple
|
:type timeout: float or tuple
|
||||||
:param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.
|
:param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.
|
||||||
:type allow_redirects: bool
|
:type allow_redirects: bool
|
||||||
|
|
|
@ -828,10 +828,10 @@ class Response(object):
|
||||||
http_error_msg = ''
|
http_error_msg = ''
|
||||||
|
|
||||||
if 400 <= self.status_code < 500:
|
if 400 <= self.status_code < 500:
|
||||||
http_error_msg = '%s Client Error: %s' % (self.status_code, self.reason)
|
http_error_msg = '%s Client Error: %s for url: %s' % (self.status_code, self.reason, self.url)
|
||||||
|
|
||||||
elif 500 <= self.status_code < 600:
|
elif 500 <= self.status_code < 600:
|
||||||
http_error_msg = '%s Server Error: %s' % (self.status_code, self.reason)
|
http_error_msg = '%s Server Error: %s for url: %s' % (self.status_code, self.reason, self.url)
|
||||||
|
|
||||||
if http_error_msg:
|
if http_error_msg:
|
||||||
raise HTTPError(http_error_msg, response=self)
|
raise HTTPError(http_error_msg, response=self)
|
||||||
|
|
|
@ -62,12 +62,11 @@ def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
|
||||||
merged_setting = dict_class(to_key_val_list(session_setting))
|
merged_setting = dict_class(to_key_val_list(session_setting))
|
||||||
merged_setting.update(to_key_val_list(request_setting))
|
merged_setting.update(to_key_val_list(request_setting))
|
||||||
|
|
||||||
# Remove keys that are set to None.
|
# Remove keys that are set to None. Extract keys first to avoid altering
|
||||||
for (k, v) in request_setting.items():
|
# the dictionary during iteration.
|
||||||
if v is None:
|
none_keys = [k for (k, v) in merged_setting.items() if v is None]
|
||||||
del merged_setting[k]
|
for key in none_keys:
|
||||||
|
del merged_setting[key]
|
||||||
merged_setting = dict((k, v) for (k, v) in merged_setting.items() if v is not None)
|
|
||||||
|
|
||||||
return merged_setting
|
return merged_setting
|
||||||
|
|
||||||
|
@ -275,6 +274,12 @@ class Session(SessionRedirectMixin):
|
||||||
>>> s = requests.Session()
|
>>> s = requests.Session()
|
||||||
>>> s.get('http://httpbin.org/get')
|
>>> s.get('http://httpbin.org/get')
|
||||||
200
|
200
|
||||||
|
|
||||||
|
Or as a context manager::
|
||||||
|
|
||||||
|
>>> with requests.Session() as s:
|
||||||
|
>>> s.get('http://httpbin.org/get')
|
||||||
|
200
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__attrs__ = [
|
__attrs__ = [
|
||||||
|
@ -418,8 +423,8 @@ class Session(SessionRedirectMixin):
|
||||||
:param auth: (optional) Auth tuple or callable to enable
|
:param auth: (optional) Auth tuple or callable to enable
|
||||||
Basic/Digest/Custom HTTP Auth.
|
Basic/Digest/Custom HTTP Auth.
|
||||||
:param timeout: (optional) How long to wait for the server to send
|
:param timeout: (optional) How long to wait for the server to send
|
||||||
data before giving up, as a float, or a (`connect timeout, read
|
data before giving up, as a float, or a :ref:`(connect timeout,
|
||||||
timeout <user/advanced.html#timeouts>`_) tuple.
|
read timeout) <timeouts>` tuple.
|
||||||
:type timeout: float or tuple
|
:type timeout: float or tuple
|
||||||
:param allow_redirects: (optional) Set to True by default.
|
:param allow_redirects: (optional) Set to True by default.
|
||||||
:type allow_redirects: bool
|
:type allow_redirects: bool
|
||||||
|
|
|
@ -67,7 +67,7 @@ def super_len(o):
|
||||||
return len(o.getvalue())
|
return len(o.getvalue())
|
||||||
|
|
||||||
|
|
||||||
def get_netrc_auth(url):
|
def get_netrc_auth(url, raise_errors=False):
|
||||||
"""Returns the Requests tuple auth for a given url from netrc."""
|
"""Returns the Requests tuple auth for a given url from netrc."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -105,8 +105,9 @@ def get_netrc_auth(url):
|
||||||
return (_netrc[login_i], _netrc[2])
|
return (_netrc[login_i], _netrc[2])
|
||||||
except (NetrcParseError, IOError):
|
except (NetrcParseError, IOError):
|
||||||
# If there was a parsing error or a permissions issue reading the file,
|
# If there was a parsing error or a permissions issue reading the file,
|
||||||
# we'll just skip netrc auth
|
# we'll just skip netrc auth unless explicitly asked to raise errors.
|
||||||
pass
|
if raise_errors:
|
||||||
|
raise
|
||||||
|
|
||||||
# AppEngine hackiness.
|
# AppEngine hackiness.
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
|
|
Loading…
Reference in a new issue