1

我不能使用 Pyngrok

每次我使用模块 pyngrok 运行脚本时,它都会显示错误:

Downloading ngrok ...
Traceback (most recent call last):
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send
    self.connect()
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1070, in _create
    self.do_handshake()
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1341, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\installer.py", line 94, in install_ngrok
    download_path = _download_file(url, **kwargs)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\installer.py", line 215, in _download_file
    response = urlopen(url, **kwargs)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\server1.py", line 12, in <module>
    public_url = ngrok.connect(port, "tcp", options={"remote_addr": "{}:{}".format(host, port)})
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\ngrok.py", line 251, in connect
    api_url = get_ngrok_process(pyngrok_config).api_url
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\ngrok.py", line 160, in get_ngrok_process
    install_ngrok(pyngrok_config)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\ngrok.py", line 98, in install_ngrok
    installer.install_ngrok(pyngrok_config.ngrok_path)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\pyngrok\installer.py", line 98, in install_ngrok
    raise PyngrokNgrokInstallError("An error occurred while downloading ngrok from {}: {}".format(url, e))
pyngrok.exception.PyngrokNgrokInstallError: An error occurred while downloading ngrok from https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>

请帮忙!

操作系统:Windows11 家庭单语言 CPU:Intel i5 python 版本:3.10.2(我也在 3.9.7 上试过)

我什至尝试更新 python 和我的操作系统,但它不起作用!

[SSL: CERTIFICATE_VERIFY_FAILED]
4

0 回答 0