From 79c51c16ccf56431835fc18d53c3255897fc4b4a Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sat, 13 Aug 2016 00:25:18 -0400 Subject: [PATCH] Fix localization --- metrik/tasks/ice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/metrik/tasks/ice.py b/metrik/tasks/ice.py index 176120f..daa42d1 100644 --- a/metrik/tasks/ice.py +++ b/metrik/tasks/ice.py @@ -1,6 +1,7 @@ from __future__ import print_function import csv +import pytz from dateutil.tz import tzlocal import requests from collections import namedtuple @@ -64,7 +65,9 @@ class LiborRateTask(MongoCreateTask): logging.info('Received string for publication time: {}'.format(row['publication'])) dt = parse(row['publication']) if dt.tzinfo is None: - dt = tzlocal().localize(dt) + tzname = tzlocal().tzname + tz = pytz.timezone(tzname) + dt = tz.localize(dt) logging.info('Parsed datetime: {}'.format(dt)) logging.info('Parse timezone: {}'.format(dt.tzinfo)) dt = dt.replace(year=date.year, month=date.month, day=date.day)