Skip to content

Commit 3f5eb14

Browse files
authored
ENH: add a timeout parameter (EDGAR tests hanging) (#234)
1 parent 6da4a80 commit 3f5eb14

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas_datareader/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class _BaseReader(object):
4444
_format = 'string'
4545

4646
def __init__(self, symbols, start=None, end=None,
47-
retry_count=3, pause=0.1, session=None):
47+
retry_count=3, pause=0.1, timeout=30, session=None):
4848
self.symbols = symbols
4949

5050
start, end = self._sanitize_dates(start, end)
@@ -55,6 +55,7 @@ def __init__(self, symbols, start=None, end=None,
5555
raise ValueError("'retry_count' must be integer larger than 0")
5656
self.retry_count = retry_count
5757
self.pause = pause
58+
self.timeout = timeout
5859
self.session = self._init_session(session, retry_count)
5960

6061
def _init_session(self, session, retry_count):

pandas_datareader/edgar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _fix_old_file_paths(self, path):
154154

155155
def read(self):
156156
try:
157-
self._sec_ftp_session = FTP(_SEC_FTP)
157+
self._sec_ftp_session = FTP(_SEC_FTP, timeout=self.timeout)
158158
self._sec_ftp_session.login()
159159
except EOFError:
160160
raise RemoteDataError('FTP server has closed the connection.')

0 commit comments

Comments
 (0)