Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Amazon S3 date format #1397

Merged
merged 3 commits into from

2 participants

@fivethreeo

S3 returns wrong date format.

Now trying strptime on RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'

http://code.larlet.fr/django-storages/issue/156/s3boto-backend-valueerror-time-data-thu-07

boto/__init__.py
@@ -36,7 +36,7 @@
import urlparse
from boto.exception import InvalidUriError
-__version__ = '2.8.0-dev'
@kopertop Owner

This change shouldn't be included with this push. Shouldn't push version changes with a pull-request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@kopertop
Owner

This looks good to me since its just adding another fallback. Anyone see any issues with this change?

@kopertop kopertop merged commit d8acad5 into boto:develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. @fivethreeo

    try RFC1123

    fivethreeo authored
  2. @fivethreeo

    Update __init__.py

    fivethreeo authored
Commits on Mar 23, 2013
  1. @fivethreeo

    no version change

    fivethreeo authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +7 −4 boto/utils.py
View
11 boto/utils.py
@@ -378,7 +378,7 @@ def get_instance_userdata(version='latest', sep=None,
ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
-
+RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
def get_ts(ts=None):
if not ts:
@@ -392,9 +392,12 @@ def parse_ts(ts):
dt = datetime.datetime.strptime(ts, ISO8601)
return dt
except ValueError:
- dt = datetime.datetime.strptime(ts, ISO8601_MS)
- return dt
-
+ try:
+ dt = datetime.datetime.strptime(ts, ISO8601_MS)
+ return dt
+ except ValueError:
+ dt = datetime.datetime.strptime(ts, RFC1123)
+ return dt
def find_class(module_name, class_name=None):
if class_name:
Something went wrong with that request. Please try again.