Skip to content
toomore edited this page May 8, 2012 · 1 revision

以下文章由 雨蒼 提供

git clone使用:

git clone git://github.com/toomore/grs.git cd grs sudo python setup.py

使用時如果出現問題:

>>> g = grs.stock(2618)
Traceback (most recent call last):
 File "<input>", line 1, in <module>
 File "grs/fetch_data.py", line 40, in __init__
   self.__raw_data = self.__serial_fetch(stock_no, mons)
 File "grs/fetch_data.py", line 118, in __serial_fetch
   tolist = self.__to_list(self.__fetch_data(no, nowdatetime))
 File "grs/fetch_data.py", line 86, in __fetch_data
   cc = urllib2.urlopen(url)
 File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
   return _opener.open(url, data, timeout)
 File "/usr/lib/python2.7/urllib2.py", line 400, in open
   response = self._open(req, data)
 File "/usr/lib/python2.7/urllib2.py", line 418, in _open
   '_open', req)
 File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
   result = func(*args)
 File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
   return self.do_open(httplib.HTTPConnection, req)
 File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
   raise URLError(err)
URLError: <urlopen error [Errno 110] 連線超過時間>

表示該地網路可能難以訪問證交所網站。請搭配 proxy 使用。若要使用 proxy,可以搭配 proxychains 使用。

例如:

proxychains python
>>> import grs

proxychains 的設定檔放在 /etc/proxychains.conf,相關設定請參考網路說明。

Clone this wiki locally