Skip to content

Commit 4fc8a83

Browse files
authored
[BitBucket] Fix error with timezone formatting (atlassian-api#1441)
* [BitBucket] Fix error with timezone formatting * reformat for black
1 parent b866ae7 commit 4fc8a83

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

atlassian/bitbucket/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ def get_time(self, id):
164164
# The format contains a : in the timezone which is supported from 3.7 on.
165165
if sys.version_info <= (3, 7):
166166
value_str = RE_TIMEZONE.sub(r"\1\2", value_str)
167-
value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
167+
try:
168+
value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
169+
except ValueError:
170+
value = datetime.strptime(value_str, "%Y-%m-%dT%H:%M:%S.%fZ", tzinfo="UTC")
168171
else:
169172
value = value_str
170173

0 commit comments

Comments
 (0)