aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--S3.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/S3.py b/S3.py
index 2456732..a8c6f1f 100644
--- a/S3.py
+++ b/S3.py
@@ -272,7 +272,13 @@ class AWSAuthConnection:
272 # add auth header 272 # add auth header
273 self._add_aws_auth_header(final_headers, method, bucket, key, query_args) 273 self._add_aws_auth_header(final_headers, method, bucket, key, query_args)
274 274
275 connection.request(method, path, data, final_headers) 275 try:
276 connection.request(method, path, data, final_headers)
277 except:
278 # Sometimes the connection is reset by peer. If that happens
279 # just try it again and we'll see what happens.
280 connection.request(method, path, data, final_headers)
281
276 resp = connection.getresponse() 282 resp = connection.getresponse()
277 if resp.status < 300 or resp.status >= 400: 283 if resp.status < 300 or resp.status >= 400:
278 return resp 284 return resp
@@ -475,7 +481,7 @@ class ListBucketResponse(Response):
475class ListAllMyBucketsResponse(Response): 481class ListAllMyBucketsResponse(Response):
476 def __init__(self, http_response): 482 def __init__(self, http_response):
477 Response.__init__(self, http_response) 483 Response.__init__(self, http_response)
478 if http_response.status < 300: 484 if http_response.status < 300:
479 handler = ListAllMyBucketsHandler() 485 handler = ListAllMyBucketsHandler()
480 xml.sax.parseString(self.body, handler) 486 xml.sax.parseString(self.body, handler)
481 self.entries = handler.entries 487 self.entries = handler.entries
@@ -501,7 +507,7 @@ class GetResponse(Response):
501class LocationResponse(Response): 507class LocationResponse(Response):
502 def __init__(self, http_response): 508 def __init__(self, http_response):
503 Response.__init__(self, http_response) 509 Response.__init__(self, http_response)
504 if http_response.status < 300: 510 if http_response.status < 300:
505 handler = LocationHandler() 511 handler = LocationHandler()
506 xml.sax.parseString(self.body, handler) 512 xml.sax.parseString(self.body, handler)
507 self.location = handler.location 513 self.location = handler.location