您好我正在尝试使用 API,当我尝试连接到此 API 时它显示错误:
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 socket
import http.client
import mimetypes
import json
import base64
import sys
mi_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")
可能是什么问题?谢谢!
慕哥6287543
相关分类