FX31337 / FX-BT-Scripts

:page_facing_up: Useful scripts for backtesting.
MIT License
35 stars 39 forks source link

socket.error: [Errno 110] Connection timed out #68

Closed kenorb closed 8 years ago

kenorb commented 8 years ago

We should catch the error and re-try the download (e.g. 5 times).

Error:

Downloading http://www.dukascopy.com/datafeed/EOANDEEUR/2015/09/06/07h_ticks.bi5 into: download/dukascopy/EOANDEEUR/2015/10/2015-10-06--07h_ticks.bi5...
Traceback (most recent call last):
  File "/usr/lib/python3.2/urllib/request.py", line 1542, in open
    return getattr(self, name)(url)
  File "/usr/lib/python3.2/urllib/request.py", line 1720, in open_http
    return self._open_generic_http(http.client.HTTPConnection, url, data)
  File "/usr/lib/python3.2/urllib/request.py", line 1700, in _open_generic_http
    http_conn.request("GET", selector, headers=headers)
  File "/usr/lib/python3.2/http/client.py", line 970, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.2/http/client.py", line 1008, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.2/http/client.py", line 966, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.2/http/client.py", line 811, in _send_output
    self.send(msg)
  File "/usr/lib/python3.2/http/client.py", line 749, in send
    self.connect()
  File "/usr/lib/python3.2/http/client.py", line 727, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.2/socket.py", line 415, in create_connection
    raise err
  File "/usr/lib/python3.2/socket.py", line 406, in create_connection
    sock.connect(sa)
socket.error: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./dl_bt_dukascopy.py", line 384, in <module>
    ds.download()
  File "./dl_bt_dukascopy.py", line 284, in download
    urllib.request.urlretrieve(self.url, filename=self.path)
  File "/usr/lib/python3.2/urllib/request.py", line 151, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python3.2/urllib/request.py", line 1574, in retrieve
    fp = self.open(url, data)
  File "/usr/lib/python3.2/urllib/request.py", line 1546, in open
    raise IOError('socket error', msg).with_traceback(sys.exc_info()[2])
  File "/usr/lib/python3.2/urllib/request.py", line 1542, in open
    return getattr(self, name)(url)
  File "/usr/lib/python3.2/urllib/request.py", line 1720, in open_http
    return self._open_generic_http(http.client.HTTPConnection, url, data)
  File "/usr/lib/python3.2/urllib/request.py", line 1700, in _open_generic_http
    http_conn.request("GET", selector, headers=headers)
  File "/usr/lib/python3.2/http/client.py", line 970, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.2/http/client.py", line 1008, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.2/http/client.py", line 966, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.2/http/client.py", line 811, in _send_output
    self.send(msg)
  File "/usr/lib/python3.2/http/client.py", line 749, in send
    self.connect()
  File "/usr/lib/python3.2/http/client.py", line 727, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.2/socket.py", line 415, in create_connection
    raise err
  File "/usr/lib/python3.2/socket.py", line 406, in create_connection
    sock.connect(sa)
IOError: [Errno socket error] [Errno 110] Connection timed out

Est. 1-2h

lu43n commented 8 years ago

Done in #69

Time: 1h