diff options
| author | jason | 2010-01-18 13:59:22 -0700 |
|---|---|---|
| committer | jason | 2010-01-18 13:59:22 -0700 |
| commit | b829545ffffce169f7a7b8ad72e670e75c000836 (patch) | |
| tree | 4ba498677f05af156044dbd1424b3f7eb6246227 | |
| parent | 6a173a52be4dda0821fb6defef8f6fe9daddfcf2 (diff) | |
| download | amazons3-py-b829545ffffce169f7a7b8ad72e670e75c000836.tar.gz amazons3-py-b829545ffffce169f7a7b8ad72e670e75c000836.zip | |
Added some code to retry failed connections to S3
| -rw-r--r-- | S3.py | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -277,7 +277,8 @@ class AWSAuthConnection: | |||
| 277 | except: | 277 | except: |
| 278 | # Sometimes the connection is reset by peer. If that happens | 278 | # Sometimes the connection is reset by peer. If that happens |
| 279 | # just try it again and we'll see what happens. | 279 | # just try it again and we'll see what happens. |
| 280 | connection.request(method, path, data, final_headers) | 280 | connection.close() |
| 281 | continue | ||
| 281 | 282 | ||
| 282 | resp = connection.getresponse() | 283 | resp = connection.getresponse() |
| 283 | if resp.status < 300 or resp.status >= 400: | 284 | if resp.status < 300 or resp.status >= 400: |
| @@ -297,6 +298,7 @@ class AWSAuthConnection: | |||
| 297 | if query: | 298 | if query: |
| 298 | path += "?" + query | 299 | path += "?" + query |
| 299 | # retry with redirect | 300 | # retry with redirect |
| 301 | connection.close() | ||
| 300 | 302 | ||
| 301 | def _add_aws_auth_header(self, headers, method, bucket, key, query_args): | 303 | def _add_aws_auth_header(self, headers, method, bucket, key, query_args): |
| 302 | if not headers.has_key('Date'): | 304 | if not headers.has_key('Date'): |