From 1cc34a14859a0f4309a3d0f02eb619a16ae108dc Mon Sep 17 00:00:00 2001 From: fredfortier Date: Tue, 24 Oct 2017 19:01:30 -0400 Subject: [PATCH] Fixed urllib package for back compatibility --- catalyst/exchange/bittrex/bittrex_api.py | 2 +- catalyst/exchange/exchange_utils.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/catalyst/exchange/bittrex/bittrex_api.py b/catalyst/exchange/bittrex/bittrex_api.py index 38e2a444..bc31607d 100644 --- a/catalyst/exchange/bittrex/bittrex_api.py +++ b/catalyst/exchange/bittrex/bittrex_api.py @@ -4,10 +4,10 @@ import time import hmac import hashlib -from six.moves import urllib # Workaround for backwards compatibility # https://stackoverflow.com/questions/3745771/urllib-request-in-python-2-7 +from six.moves import urllib urlopen = urllib.request.urlopen diff --git a/catalyst/exchange/exchange_utils.py b/catalyst/exchange/exchange_utils.py index f12f4df1..05a17435 100644 --- a/catalyst/exchange/exchange_utils.py +++ b/catalyst/exchange/exchange_utils.py @@ -1,13 +1,12 @@ import json import os import pickle -import urllib +from six.moves.urllib.request import urlretrieve from datetime import date, datetime import pandas as pd -from catalyst.exchange.exchange_errors import ExchangeAuthNotFound, \ - ExchangeSymbolsNotFound +from catalyst.exchange.exchange_errors import ExchangeSymbolsNotFound from catalyst.utils.paths import data_root, ensure_directory, \ last_modified_time @@ -34,7 +33,7 @@ def get_exchange_symbols_filename(exchange_name, environ=None): def download_exchange_symbols(exchange_name, environ=None): filename = get_exchange_symbols_filename(exchange_name) url = SYMBOLS_URL.format(exchange=exchange_name) - response = urllib.urlretrieve(url=url, filename=filename) + response = urlretrieve(url=url, filename=filename) return response