From 5ed085e73f5d64508d50891e271534440c355a58 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 25 Dec 2013 22:46:43 -0500 Subject: [PATCH] changed dict key from datr str to date type --- setup.py | 1 + ystockquote.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c8712d5..03fa227 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ download_url='http://pypi.python.org/pypi/ystockquote', keywords='stocks stockmarket market finance yahoo quotes'.split(), license='GNU LGPLv2+', + install_requires=['python-dateutil >= 2.2'], classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', diff --git a/ystockquote.py b/ystockquote.py index 7cce2d2..90bae92 100644 --- a/ystockquote.py +++ b/ystockquote.py @@ -15,6 +15,8 @@ __version__ = '0.2.5dev' +from dateutil.parser import parse + try: # py3 from urllib.request import Request, urlopen @@ -489,7 +491,7 @@ def get_historical_prices(symbol, start_date, end_date): keys = daily_data[0].split(',') for day in daily_data[1:]: day_data = day.split(',') - date = day_data[0] + date = parse(day_data[0]).date() hist_dict[date] = \ {keys[1]: day_data[1], keys[2]: day_data[2],