最近剛學linux centos
當我使用python爬中央氣象局的資料的時候
都會出現SSLERROR的情況
爬其他網站都不會!!
有邦友遇到相同的問題嗎?
這是我的py檔
import json
import requests
url = 'https://opendata.cwb.gov.tw/api/v1/rest/datastore/F-C0032-001?Authorization=CWB-37A&format=JSON&elementName=PoP'
htmls = requests.get(url)
data = htmls.json()
p.s.
已經試過,一樣給Error
htmls = requests.get(url,verify="False")
執行後出現的錯誤
Traceback (most recent call last):
File "/home/yen/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 591, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/home/yen/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 249, in _get_conn
return conn or self._new_conn()
File "/home/yen/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 818, in _new_conn
raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yen/env/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/yen/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/yen/env/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='opendata.cwb.gov.tw', port=443): Max retries exceeded with url: /api/v1/rest/datastore/F-C0032-001?Authorization=CWB-3CE2FA7&format=JSON&elementName=PoP (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/yen/env/lib/python3.7/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/home/yen/env/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/home/yen/env/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/yen/env/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/yen/env/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='opendata.cwb.gov.tw', port=443): Max retries exceeded with url: /api/v1/rest/datastore/F-C0032-001?Authorization=CWB-NA-F8C-4F1-B32-0225CE2FA7&format=JSON&elementName=PoP (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
感恩
改這樣子
htmls = requests.get(url,verify=False)
請問貴公司有 Exchange Server嗎? 是否有開啟web mail(OWA), 如果有的話, 可以透過web mail來更改密碼.
https://phoenixnap.com/kb/how-to-install-python-3-centos-7-bitlife