您好我正在嘗試使用 API,當(dāng)我嘗試連接到此 API 時(shí)它顯示錯(cuò)誤: File "C:\python_course\server.py", line 16, in <module> conn = http.client.HTTPSConnection("https://libredte.cl") File "C:\Python38\lib\http\client.py", line 1367, in __init__ super(HTTPSConnection, self).__init__(host, port, timeout, File "C:\Python38\lib\http\client.py", line 829, in __init__ (self.host, self.port) = self._get_hostport(host, port) File "C:\Python38\lib\http\client.py", line 872, in _get_hostport raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) http.client.InvalidURL: nonnumeric port: '//libredte.cl'我的代碼是這樣的:import socketimport http.clientimport mimetypesimport jsonimport base64import sysmi_socket = socket.socket()mi_socket.bind( ('localhost', 5404) )mi_socket.listen(5)cmd = 'user:password'b64cmd = base64.b64encode(cmd.encode('utf_16_le')).decode('utf-8')conn = http.client.HTTPSConnection("https://libredte.cl")可能是什么問(wèn)題?謝謝!
1 回答

慕哥6287543
TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超10個(gè)贊
從 url 中刪除協(xié)議部分:
conn = http.client.HTTPSConnection("libredte.cl")
添加回答
舉報(bào)
0/150
提交
取消