Skip to content

Commit 15952b6

Browse files
Daniel EisnerDaniel Eisner
authored andcommitted
Minor bug fixes
1 parent b600194 commit 15952b6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas_datareader/nasdaq_trader.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def _download_nasdaq_symbols(timeout):
4141

4242
lines = []
4343
try:
44-
ftp_session.retrlines('RETR ' +_NASDAQ_TICKER_LOC, lines.append)
44+
ftp_session.retrlines('RETR ' + _NASDAQ_TICKER_LOC, lines.append)
4545
except all_errors as err:
4646
raise RemoteDataError('Error downloading from %r: $s' %
4747
(_NASDAQ_FTP_SERVER, err))
4848
finally:
4949
ftp_session.close()
5050

5151
# Sanity Checking
52-
if not lines[-1].startwith('File Creation Time:'):
52+
if not lines[-1].startswith('File Creation Time:'):
5353
raise RemoteDataError('Missing expected footer. Found %r' % lines[-1])
5454

5555
# Convert Y/N to True/False.
@@ -74,8 +74,10 @@ def get_nasdaq_symbols(retry_count=3, timeout=30, pause=None):
7474
Returns
7575
-------
7676
nasdaq_tickers : pandas.DataFrame
77-
DataFrame wiht company tickers, names, and other properties.
77+
DataFrame with company tickers, names, and other properties.
7878
"""
79+
global _ticker_cache
80+
7981
if timeout < 0:
8082
raise ValueError('timeout must be >= 0, not %r' % (timeout,))
8183

@@ -84,15 +86,14 @@ def get_nasdaq_symbols(retry_count=3, timeout=30, pause=None):
8486
elif pause < 0:
8587
raise ValueError('pause must be >= 0, not %r' % (pause,))
8688

87-
global _ticker_cache
8889
if _ticker_cache is None:
8990
while retry_count > 0:
9091
try:
9192
_ticker_cache = _download_nasdaq_symbols(timeout=timeout)
9293
retry_count = -1
93-
except Exception:
94+
except RemoteDataError:
9495
# retry on any exception
95-
if retry_count == 0:
96+
if retry_count <= 0:
9697
raise
9798
else:
9899
retry_count -= 1

0 commit comments

Comments
 (0)