mirror of
				https://github.com/bspeice/metrik
				synced 2025-10-31 01:10:42 -04:00 
			
		
		
		
	Use an actual package for localization
This commit is contained in:
		| @ -1,8 +1,7 @@ | |||||||
| from __future__ import print_function | from __future__ import print_function | ||||||
|  |  | ||||||
| import csv | import csv | ||||||
| import pytz | from tzlocal import get_localzone | ||||||
| from dateutil.tz import tzlocal |  | ||||||
| import requests | import requests | ||||||
| from collections import namedtuple | from collections import namedtuple | ||||||
| from dateutil.parser import parse | from dateutil.parser import parse | ||||||
| @ -65,8 +64,7 @@ class LiborRateTask(MongoCreateTask): | |||||||
|                 logging.info('Received string for publication time: {}'.format(row['publication'])) |                 logging.info('Received string for publication time: {}'.format(row['publication'])) | ||||||
|                 dt = parse(row['publication']) |                 dt = parse(row['publication']) | ||||||
|                 if dt.tzinfo is None: |                 if dt.tzinfo is None: | ||||||
|                     tzname = tzlocal().tzname |                     tz = get_localzone() | ||||||
|                     tz = pytz.timezone(tzname) |  | ||||||
|                     dt = tz.localize(dt) |                     dt = tz.localize(dt) | ||||||
|                 logging.info('Parsed datetime: {}'.format(dt)) |                 logging.info('Parsed datetime: {}'.format(dt)) | ||||||
|                 logging.info('Parse timezone: {}'.format(dt.tzinfo)) |                 logging.info('Parse timezone: {}'.format(dt.tzinfo)) | ||||||
|  | |||||||
| @ -4,3 +4,4 @@ pyquery>=1.2.9 | |||||||
| requests>=2.9.1 | requests>=2.9.1 | ||||||
| pandas>=0.17.1 | pandas>=0.17.1 | ||||||
| pymongo>=3.2 | pymongo>=3.2 | ||||||
|  | tzlocal>=1.2.2 | ||||||
		Reference in New Issue
	
	Block a user
	 Bradlee Speice
					Bradlee Speice