gpt4 book ai didi

adafruit_requests Error: x509-crt-bundle:Failed to verify certificate(ADAFRUIT_REQUESTS错误:x509-crt-Bundle:无法验证证书)

转载 作者:bug小助手 更新时间:2023-10-25 23:09:23 28 4
gpt4 key购买 nike



I'm trying to get data from a weather API on a Raspberry Pi Pico running CircuitPython. It works on this API. Code:

我正在尝试从Raspberry Pi Pico Running CircuitPython上的天气API中获取数据。它在此接口上工作。代码:


pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
url = "https://api.weatherapi.com/v1/current.json?key=?????????????????????????&q=Berlin"
response = requests.get(url)
data = json.loads(response.text)
print(data["temp_c"])

Error:

错误:


x509-crt-bundle:Failed to verify certificate
Backtracking (most recent request last):
File "adafruit_requests.py", line 515, in _get_socket
OSError: (-12288, 'MBEDTLS_ERR_X509_FATAL_ERROR')

The above exception was the direct cause of the following exception:

Backtracking (most recent request last):
File "<stdin>", line 139, in <module>
File "<stdin>", line 95, in getWeather
File "adafruit_requests.py", line 711, in get
File "adafruit_requests.py", line 650, in request
File "adafruit_requests.py", line 496, in _get_socket
RuntimeError: Sending request failed

更多回答

Your 'works' case is not https so it does not even try to use any certificate. Did or can you try HTTPS://worldtimeapi.org -- which uses a LetsEncrypt cert similar to that for api.weatherapi.com ? How about non-LE sites like https://www.google.com https://www.bing.com https://www.amazon.com ?

您的‘Works’案例不是HTTPS,因此它甚至不会尝试使用任何证书。您是否尝试过HTTPS://Worldtimeapi.org--它使用的是与api.weaTreati.com类似的LetsEncrypt证书?像https://www.google.com https://www.bing.com https://www.amazon.com这样的非LE网站呢?

You didn't actually ask a question. This error means that 1) the service you are connecting to is not configured correctly 2) your local clock is very out of sync 3) Your client cannot negotiate the protocol / cipher or 4) you don't have a local version of the CA cert to validate against.

你实际上并没有问我问题。此错误意味着1)您正在连接的服务配置不正确2)您的本地时钟非常不同步3)您的客户端无法协商协议/密码或4)您没有本地版本的CA证书可供验证。

优秀答案推荐
更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com