Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

連線嘗試失敗 #111

Closed
h9052300 opened this issue Apr 15, 2024 · 3 comments
Closed

連線嘗試失敗 #111

h9052300 opened this issue Apr 15, 2024 · 3 comments

Comments

@h9052300
Copy link

.\twstock.exe -U
Start to update codes
Traceback (most recent call last):
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
raise err
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] 連線嘗試失敗,因為連線對象有一段時間並未正確回應,或是連線建立失敗,因為連線的主機無法回 應。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x00000251FA510F70>: Failed to establish a new connection: [WinError 10060] 連線嘗試失敗,因為連線對象有一段時間並未正確回應,或是連線建立失敗,因為連線的 主機無法回應。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='isin.twse.com.tw', port=8443): Max retries exceeded with url: /isin/C_public.jsp?strMode=2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000251FA510F70>: Failed to establish a new connection: [WinError 10060] 連線嘗試失敗,因為連線對象有一段時間並未正確回應,或是連線建立失敗,因為連線的主機無法回應。'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\Scripts\twstock.exe_main
.py", line 7, in
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\twstock\cli_init
.py", line 26, in run
__update_codes()
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\twstock\codes\fetch.py", line 60, in __update_codes
to_csv(TWSE_EQUITIES_URL, os.path.join(get_directory(), 'twse_equities.csv'))
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\twstock\codes\fetch.py", line 48, in to_csv
data = fetch_data(url)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\twstock\codes\fetch.py", line 30, in fetch_data
r = requests.get(url, proxies=get_proxies())
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\sessions.py", line 723, in send
history = [resp for resp in gen]
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\sessions.py", line 723, in
history = [resp for resp in gen]
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\sessions.py", line 266, in resolve_redirects
resp = self.send(
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\requests\adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='isin.twse.com.tw', port=8443): Max retries exceeded with url: /isin/C_public.jsp?strMode=2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000251FA510F70>: Failed to establish a new connection: [WinError 10060] 連線嘗試失敗,因為連線對象有一段時間並未正確回應,或 是連線建立失敗,因為連線的主機無法回應。'))

@hsiang0100
Copy link

你可以先測試一下你ping的到isin.twse.com.tw這個網址嗎

@h9052300
Copy link
Author

h9052300 commented Apr 16, 2024

C:\Users\user>ping isin.twse.com.tw

Ping isin.twse.com.tw [122.147.34.138] (使用 32 位元組的資料):
回覆自 122.147.34.138: 位元組=32 時間=7ms TTL=244
回覆自 122.147.34.138: 位元組=32 時間=6ms TTL=244
回覆自 122.147.34.138: 位元組=32 時間=6ms TTL=244
回覆自 122.147.34.138: 位元組=32 時間=7ms TTL=244

122.147.34.138 的 Ping 統計資料:
封包: 已傳送 = 4,已收到 = 4, 已遺失 = 0 (0% 遺失),
大約的來回時間 (毫秒):
最小值 = 6ms,最大值 = 7ms,平均 = 6ms

可以ping的到,謝謝您的回覆~

我剛剛又再更新了一次,還是會發生連線嘗試失敗,想請問是否能夠提供tpex_equities.csv跟twse_equities.csv的檔案下載,這樣能否完成股票資料的更新呢?

@mlouielu
Copy link
Owner

Close by #117. Please try again twstock -U.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants