hisen630 / my_stock

GNU General Public License v2.0
1 stars 1 forks source link

download time out #1

Open hisen630 opened 9 years ago

hisen630 commented 9 years ago

It likely to exit without 0 for about 2 hours. Check the err message, it says:

Traceback (most recent call last):
  File "dump_stock.py", line 137, in <module>
    downloader.download()
  File "dump_stock.py", line 72, in download
    df = ts.get_h_data(stock.code, start=start, end=end, pause=3)
  File "/home/work/anaconda/lib/python2.7/site-packages/tushare/stock/trading.py", line 387, in get_h_data
    df = _parase_fq_factor(code, start, end)
  File "/home/work/anaconda/lib/python2.7/site-packages/tushare/stock/trading.py", line 431, in _parase_fq_factor
    text = urlopen(request, timeout=10).read()
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 1227, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/home/work/anaconda/lib/python2.7/urllib2.py", line 1200, in do_open
    r = h.getresponse(buffering=True)
  File "/home/work/anaconda/lib/python2.7/httplib.py", line 1132, in getresponse
    response.begin()
  File "/home/work/anaconda/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/home/work/anaconda/lib/python2.7/httplib.py", line 409, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/home/work/anaconda/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
socket.timeout: timed out

The program should save the last successful info A.K.A a breakpoint, and when the program fail, just start from the breakpoint.

hisen630 commented 9 years ago

Create a new table in the database to record the task's status and processing. And the main program will support another new option for pick up a failure.