diff --git a/metrik/tasks/ice.py b/metrik/tasks/ice.py index daa42d1..b03e477 100644 --- a/metrik/tasks/ice.py +++ b/metrik/tasks/ice.py @@ -1,8 +1,7 @@ from __future__ import print_function import csv -import pytz -from dateutil.tz import tzlocal +from tzlocal import get_localzone import requests from collections import namedtuple from dateutil.parser import parse @@ -65,8 +64,7 @@ class LiborRateTask(MongoCreateTask): logging.info('Received string for publication time: {}'.format(row['publication'])) dt = parse(row['publication']) if dt.tzinfo is None: - tzname = tzlocal().tzname - tz = pytz.timezone(tzname) + tz = get_localzone() dt = tz.localize(dt) logging.info('Parsed datetime: {}'.format(dt)) logging.info('Parse timezone: {}'.format(dt.tzinfo)) diff --git a/requirements.txt b/requirements.txt index f9e60a1..696a949 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ luigi>=2.2.0 pyquery>=1.2.9 requests>=2.9.1 pandas>=0.17.1 -pymongo>=3.2 \ No newline at end of file +pymongo>=3.2 +tzlocal>=1.2.2 \ No newline at end of file diff --git a/setup.py b/setup.py index 5fbea9d..4bceaad 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,8 @@ setup( 'requests >= 2.11.0', 'six >= 1.10.0', 'pymongo >= 3.2', - 'pytz >= 2016.6.1' + 'pytz >= 2016.6.1', + 'tzlocal >= 1.2.2' ], setup_requires=[ 'pytest_runner'