aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason2010-01-18 17:01:20 -0700
committerjason2010-01-18 17:01:20 -0700
commit5449336322ff186d0ea1b111500bb9406d64d0f0 (patch)
treefae6766e1d71074622ebf1905c0e4ec82f2c8a63
parentb829545ffffce169f7a7b8ad72e670e75c000836 (diff)
downloadamazons3-py-5449336322ff186d0ea1b111500bb9406d64d0f0.tar.gz
amazons3-py-5449336322ff186d0ea1b111500bb9406d64d0f0.zip
Moved a try/except to see if i can squash the bug where s3 resets the connection all the time
-rw-r--r--S3.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/S3.py b/S3.py
index 7f40e37..b016dd5 100644
--- a/S3.py
+++ b/S3.py
@@ -272,15 +272,16 @@ 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)
276
275 try: 277 try:
276 connection.request(method, path, data, final_headers) 278 resp = connection.getresponse()
277 except: 279 except:
278 # Sometimes the connection is reset by peer. If that happens 280 # Sometimes the connection is reset by peer. If that happens
279 # just try it again and we'll see what happens. 281 # just try it again and we'll see what happens.
280 connection.close() 282 connection.close()
281 continue 283 continue
282 284
283 resp = connection.getresponse()
284 if resp.status < 300 or resp.status >= 400: 285 if resp.status < 300 or resp.status >= 400:
285 return resp 286 return resp
286 # handle redirect 287 # handle redirect