【发布时间】:2020-09-28 08:17:15
【问题描述】:
你好,这段代码有错误,但它在 python shell 中运行,任何人都可以帮助我
from machine import Pin
import time
import network
import urequests
p0 = Pin(0,Pin.OUT)
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('ssid', 'pass')
response = urequests.get('http://jsonplaceholder.typicode.com/albums/1')
while True:
ans = response.json()['userId']
p0.value(1)
time.sleep(1)
p0.off()
time.sleep(1)
print('ok')
这是错误:
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
File "urequests.py", line 108, in get
File "urequests.py", line 53, in request
OSError: -202
【问题讨论】:
-
我在网上找到的关于 OSError 的唯一内容是与 SSL 相关的内容,只是为了确保您可以在 get 请求中将 http 更改为 https 吗?
-
-202seems 与失败的getaddrinfo()调用有关。
标签: python esp32 micropython