projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e9a8298
)
Fix parse_datetime to parse API datetime string format with Python 3.6
author
Harmon
<Harmon758@gmail.com>
Thu, 28 Oct 2021 15:25:22 +0000
(10:25 -0500)
committer
Harmon
<Harmon758@gmail.com>
Thu, 28 Oct 2021 15:26:55 +0000
(10:26 -0500)
The '%z' directive didn't accept 'Z' until Python 3.7
tweepy/utils.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/utils.py
b/tweepy/utils.py
index f11bcd006a97c64e37ac6351bd634d08886dad26..4aa1c70a0514577898392c288fb58df262162489 100644
(file)
--- a/
tweepy/utils.py
+++ b/
tweepy/utils.py
@@
-12,5
+12,6
@@
def list_to_csv(item_list):
def parse_datetime(datetime_string):
return datetime.datetime.strptime(
- datetime_string, "%Y-%m-%dT%H:%M:%S.%f%z"
- )
+ datetime_string, "%Y-%m-%dT%H:%M:%S.%fZ"
+ ).replace(tzinfo=datetime.timezone.utc)
+ # Use %z when support for Python 3.6 is dropped