Use twint data export for periodic twitter data

This commit is contained in:
Dima Gerasimov 2020-04-14 21:23:35 +01:00
parent 811303fcb1
commit 6f8c2e2f24
5 changed files with 97 additions and 30 deletions

16
my/core/time.py Normal file
View file

@ -0,0 +1,16 @@
from functools import lru_cache
from datetime import datetime
import pytz # type: ignore
# https://gist.github.com/edwardabraham/8680198
tz_lookup = {
pytz.timezone(x).localize(datetime.now()).tzname(): pytz.timezone(x)
for x in pytz.all_timezones
}
tz_lookup['UTC'] = pytz.utc # ugh. otherwise it'z Zulu...
@lru_cache(-1)
def abbr_to_timezone(abbr: str):
return tz_lookup[abbr]