綁定帳號登入

Android 台灣中文網

Android 台灣中文網 標籤 連線 相關日誌

tag 標籤: 連線

相關日誌

分享 重新與自己連線
windfakeer 2024-2-12 13:58
重新與自己連線
個人分類: 每日話語|0 個評論
分享 Python 網路連線、公開資料串接 學習
jianrupan 2021-11-3 15:55
# 下載特定網址資料 # 下載特定網址資料 src = "https://www.ntu.edu.tw/" à 台大首頁 with request.urlopen(src) as response: data = response.read().decode("utf-8") # 取得網站原始碼 (HTML, CSS, JS) print(" 讀取 "+src+" 網頁原始碼 : ") print(data) print() # 串接 , 擷取公開資料 # 下載模組 import json # 台北市政府公開資料 - 臺北市內湖科技園區廠商名錄 https://data.taipei/#/dataset/detail?id=15c3e1ae-899b-466c-a536-208497e3a369 src = "https://data.taipei/api/v1/dataset/296acfa2-5d93-4706-ad58-e83cc951863c?scope=resourceAquire" with request.urlopen(src) as response: data = json.load(response) # 利用 json 模組處理 json 資料格式 print(" 讀取 "+src+" 網頁原始碼 : ") print(data) # 將公司名稱列表 clist = data print(" 公司名稱 : ") for company in clist: print(company ) # 公司名稱列表 寫入檔案 with open(" 公司名稱列表 .txt", "w", encoding="utf-8") as wFile: for company in clist: wFile.write(company +" ")
個人分類: 軟體應用|518 次閱讀|0 個評論
分享 Python 網路連線、公開資料串接 下載特定網址資料異常處理
jianrupan 2021-11-3 13:30
異常狀態發生 # 載入模組 import urllib.request as request # 指定網址 src = "https://python.org/" # 開啟網址資料 request.urlopen(src) 執行異常訊息: Traceback (most recent call last): File "...PythonPython39liburllib equest.py", line 1346, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "...PythonPython39libhttpclient.py", line 1253, in request self._send_request(method, url, body, headers, encode_chunked) File "...PythonPython39libhttpclient.py", line 1299, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "...PythonPython39libhttpclient.py", line 1248, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "...PythonPython39libhttpclient.py", line 1008, in _send_output self.send(msg) File "...PythonPython39libhttpclient.py", line 948, in send self.connect() File "...PythonPython39libhttpclient.py", line 1422, in connect self.sock = self._context.wrap_socket(self.sock, File "...PythonPython39libssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "...PythonPython39libssl.py", line 1040, in _create self.do_handshake() File "...PythonPython39libssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: certificate verify failed: certificate has expired (_ssl.c:1129) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "... et_data.py", line 9, in module request.urlopen(src) File "...PythonPython39liburllib equest.py", line 214, in urlopen return opener.open(url, data, timeout) File "...PythonPython39liburllib equest.py", line 517, in open response = self._open(req, data) File "...PythonPython39liburllib equest.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "...PythonPython39liburllib equest.py", line 494, in _call_chain result = func(*args) File "...PythonPython39liburllib equest.py", line 1389, in https_open return self.do_open(http.client.HTTPSConnection, req, File "...PythonPython39liburllib equest.py", line 1349, in do_open raise URLError(err) urllib.error.URLError: urlopen error certificate verify failed: certificate has expired (_ssl.c:1129) 搜尋異常狀態 # 載入模組 import urllib.request as request # 指定網址 src = "https://python.org/" # 開啟網址資料 #request.urlopen(src) from urllib.error import HTTPError, URLError try: request.urlopen(src) print("urlopen OK") except HTTPError as e: print("HTTP code error: ", e.reason) except URLError as error: print("URLError code error: ", error.reason) 顯示執行異常訊息: URLError code error: certificate verify failed: certificate has expired (_ssl.c:1129) 問題發生原因: 驗證 SSL 憑證異常。 修改說明: 選擇不用認證此 SSL 憑證 # 載入模組 import urllib.request as request import ssl from urllib.error import HTTPError, URLError # 指定網址 src = "https://python.org/" # 取消 SSL 憑證 認證 ssl._create_default_https_context = ssl._create_unverified_context # 開啟網址資料 try: request.urlopen(src) print("urlopen OK") except HTTPError as e: print("HTTP code error: ", e.reason) except URLError as error: print("URLError code error: ", error.reason) 顯示正確執行訊息: urlopen OK
個人分類: 軟體應用|318 次閱讀|0 個評論
分享 連線至國立勤益科技大學遠端硬碟
嵐風 2020-4-28 21:52
一、至國立勤益科技大學官網下載軟體 https://sslvpn.ncut.edu.tw:8080/remote/login?lang=en 遠程網關: sslvpn.ncut.edu.tw 自定義端口: 8080 勾選「遇到無效的伺服器證書不提示」 帳: [email protected] 密: B123230400 地址: \140.128.93.106
201 次閱讀|0 個評論