Skip to content

Commit 2a8a50c

Browse files
Add workaround for possible issue in datetime.strptime in Python 3.6
1 parent 775d4e3 commit 2a8a50c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Removed
1313
### Fixed
1414
* Fix bug that caused User-Agent header to be omitted from HTTP requests.
15-
* Fix glossary name prefix used in unit-tests to match git repository name.
15+
* Fix glossary name prefix used in unit-tests to match git repository name.
16+
* Add workaround for possible issue in datetime.strptime in Python 3.6.
1617
### Security
1718

1819

deepl/translator.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ def __str__(self) -> str:
152152
@staticmethod
153153
def from_json(json) -> "GlossaryInfo":
154154
"""Create GlossaryInfo from the given API JSON object."""
155-
# Workaround for bug in Python 3.6
155+
# Workaround for bugs in strptime() in Python 3.6
156156
creation_time = json["creation_time"]
157157
if ":" == creation_time[-3:-2]:
158158
creation_time = creation_time[:-3] + creation_time[-2:]
159+
if "Z" == creation_time[-1:]:
160+
creation_time = creation_time[:-1] + "+0000"
159161

160162
return GlossaryInfo(
161163
json["glossary_id"],

0 commit comments

Comments
 (0)