toomore / grs

📈 台灣上市上櫃股票價格擷取(Fetch Taiwan Stock Exchange data)含即時盤、台灣時間轉換、開休市判斷。
http://pypi.python.org/pypi/grs
MIT License
430 stars 164 forks source link

urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=None) #35

Open snowuyl opened 7 years ago

snowuyl commented 7 years ago

Dear toomore, I added test.py to get real time stock price of 2618. from grs import RealtimeTWSE

realtime_stock = RealtimeTWSE('2618')
realtime_stock.raw
realtime_stock.data

But when I type the following on terminal of Ubuntu 16.04. The following error occurred. Traceback (most recent call last): File "test.py", line 3, in realtime_stock = RealtimeTWSE('2618')
File "/home/snowuyl/samba/grs-master/grs/realtime2.py", line 132, in init super(RealtimeTWSE, self).init(no, date) File "/home/snowuyl/samba/grs-master/grs/realtime2.py", line 35, in init self.result = URL.request('GET', STOCKPATH % params) File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 69, in request _urlopen_kw) File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 90, in request_encode_url return self.urlopen(method, url, _extra_kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 654, in urlopen release_conn=release_conn, **response_kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 531, in urlopen raise HostChangedError(self, url, retries) urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='mis.tse.com.tw', port=None): Tried to open a foreign host with url: http://1.1.1.8

Do you have any suggestion to solve this issue?

Thanks in advance!

snowuyl

yhsiang commented 7 years ago

this duplicate with #25 and #40 will solve this!