Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/requests/packages/urllib3/exceptions.py

Issue 25004007: Update 'requests' lib to v2.0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # urllib3/exceptions.py 1 # urllib3/exceptions.py
2 # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) 2 # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
3 # 3 #
4 # This module is part of urllib3 and is released under 4 # This module is part of urllib3 and is released under
5 # the MIT License: http://www.opensource.org/licenses/mit-license.php 5 # the MIT License: http://www.opensource.org/licenses/mit-license.php
6 6
7 7
8 ## Base Exceptions 8 ## Base Exceptions
9 9
10 class HTTPError(Exception): 10 class HTTPError(Exception):
(...skipping 21 matching lines...) Expand all
32 def __reduce__(self): 32 def __reduce__(self):
33 # For pickling purposes. 33 # For pickling purposes.
34 return self.__class__, (None, self.url, None) 34 return self.__class__, (None, self.url, None)
35 35
36 36
37 class SSLError(HTTPError): 37 class SSLError(HTTPError):
38 "Raised when SSL certificate fails in an HTTPS connection." 38 "Raised when SSL certificate fails in an HTTPS connection."
39 pass 39 pass
40 40
41 41
42 class ProxyError(HTTPError):
43 "Raised when the connection to a proxy fails."
44 pass
45
46
42 class DecodeError(HTTPError): 47 class DecodeError(HTTPError):
43 "Raised when automatic decoding based on Content-Type fails." 48 "Raised when automatic decoding based on Content-Type fails."
44 pass 49 pass
45 50
46 51
47 ## Leaf Exceptions 52 ## Leaf Exceptions
48 53
49 class MaxRetryError(RequestError): 54 class MaxRetryError(RequestError):
50 "Raised when the maximum number of retries is exceeded." 55 "Raised when the maximum number of retries is exceeded."
51 56
(...skipping 11 matching lines...) Expand all
63 68
64 class HostChangedError(RequestError): 69 class HostChangedError(RequestError):
65 "Raised when an existing pool gets a request for a foreign host." 70 "Raised when an existing pool gets a request for a foreign host."
66 71
67 def __init__(self, pool, url, retries=3): 72 def __init__(self, pool, url, retries=3):
68 message = "Tried to open a foreign host with url: %s" % url 73 message = "Tried to open a foreign host with url: %s" % url
69 RequestError.__init__(self, pool, url, message) 74 RequestError.__init__(self, pool, url, message)
70 self.retries = retries 75 self.retries = retries
71 76
72 77
73 class TimeoutError(RequestError): 78 class TimeoutStateError(HTTPError):
74 "Raised when a socket timeout occurs." 79 """ Raised when passing an invalid state to a timeout """
75 pass 80 pass
76 81
77 82
83 class TimeoutError(HTTPError):
84 """ Raised when a socket timeout error occurs.
85
86 Catching this error will catch both :exc:`ReadTimeoutErrors
87 <ReadTimeoutError>` and :exc:`ConnectTimeoutErrors <ConnectTimeoutError>`.
88 """
89 pass
90
91
92 class ReadTimeoutError(TimeoutError, RequestError):
93 "Raised when a socket timeout occurs while receiving data from a server"
94 pass
95
96
97 # This timeout error does not have a URL attached and needs to inherit from the
98 # base HTTPError
99 class ConnectTimeoutError(TimeoutError):
100 "Raised when a socket timeout occurs while connecting to a server"
101 pass
102
103
78 class EmptyPoolError(PoolError): 104 class EmptyPoolError(PoolError):
79 "Raised when a pool runs out of connections and no more are allowed." 105 "Raised when a pool runs out of connections and no more are allowed."
80 pass 106 pass
81 107
82 108
83 class ClosedPoolError(PoolError): 109 class ClosedPoolError(PoolError):
84 "Raised when a request enters a pool after the pool has been closed." 110 "Raised when a request enters a pool after the pool has been closed."
85 pass 111 pass
86 112
87 113
88 class LocationParseError(ValueError, HTTPError): 114 class LocationParseError(ValueError, HTTPError):
89 "Raised when get_host or similar fails to parse the URL input." 115 "Raised when get_host or similar fails to parse the URL input."
90 116
91 def __init__(self, location): 117 def __init__(self, location):
92 message = "Failed to parse: %s" % location 118 message = "Failed to parse: %s" % location
93 HTTPError.__init__(self, message) 119 HTTPError.__init__(self, message)
94 120
95 self.location = location 121 self.location = location
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698