File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 28
28
from six import BytesIO , StringIO
29
29
from six .moves .urllib .parse import urlparse , urlunparse , quote , unquote
30
30
31
- import base64
32
31
import copy
33
- import gzip
34
32
import httplib2
35
33
import json
36
34
import logging
37
35
import mimetypes
38
36
import os
39
37
import random
40
38
import socket
41
- import sys
42
39
import time
43
40
import uuid
44
41
@@ -190,11 +187,16 @@ def _retry_request(
190
187
exception = connection_error
191
188
except socket .error as socket_error :
192
189
# errno's contents differ by platform, so we have to match by name.
190
+ # Some of these same errors may have been caught above, e.g. ECONNRESET *should* be
191
+ # raised as a ConnectionError, but some libraries will raise it as a socket.error
192
+ # with an errno corresponding to ECONNRESET
193
193
if socket .errno .errorcode .get (socket_error .errno ) not in {
194
194
"WSAETIMEDOUT" ,
195
195
"ETIMEDOUT" ,
196
196
"EPIPE" ,
197
197
"ECONNABORTED" ,
198
+ "ECONNREFUSED" ,
199
+ "ECONNRESET" ,
198
200
}:
199
201
raise
200
202
exception = socket_error
You can’t perform that action at this time.
0 commit comments