Skip to content

Commit 02f7a81

Browse files
authored
Merge pull request #610 from wshanks/wshanks-patch-1
2 parents 80523f3 + c91d70b commit 02f7a81

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/future/backports/http/cookiejar.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,14 @@ def _str2time(day, mon, yr, hr, min, sec, tz):
225225
(?::(\d\d))? # optional seconds
226226
)? # optional clock
227227
\s*
228-
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone
228+
(?:
229+
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone
230+
\s*
231+
)?
232+
(?:
233+
\(\w+\) # ASCII representation of timezone in parens.
229234
\s*
230-
(?:\(\w+\))? # ASCII representation of timezone in parens.
231-
\s*$""", re.X | re.ASCII)
235+
)?$""", re.X | re.ASCII)
232236
def http2time(text):
233237
"""Returns time in seconds since epoch of time represented by a string.
234238
@@ -298,9 +302,11 @@ def http2time(text):
298302
(?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
299303
)? # optional clock
300304
\s*
301-
([-+]?\d\d?:?(:?\d\d)?
302-
|Z|z)? # timezone (Z is "zero meridian", i.e. GMT)
303-
\s*$""", re.X | re. ASCII)
305+
(?:
306+
([-+]?\d\d?:?(:?\d\d)?
307+
|Z|z) # timezone (Z is "zero meridian", i.e. GMT)
308+
\s*
309+
)?$""", re.X | re. ASCII)
304310
def iso2time(text):
305311
"""
306312
As for http2time, but parses the ISO 8601 formats:

0 commit comments

Comments
 (0)