Permalink
Browse files

try RFC1123

  • Loading branch information...
1 parent 8a95cd0 commit cedbe55127a0bc414f6af9f59cdcaddb2745490a @fivethreeo fivethreeo committed Mar 18, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 boto/utils.py
View
@@ -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:

0 comments on commit cedbe55

Please sign in to comment.