Code: Select all
wifi.radio.connect(os.getenv('WIFI_SSID'), os.getenv('WIFI_PASSWORD'))
# prints IP address to REPL
print("IP address is", wifi.radio.ipv4_address)
aio_username = os.getenv('aio_username')
aio_key = os.getenv('aio_key')
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
# Initialize an Adafruit IO HTTP API object
io = IO_HTTP(aio_username, aio_key, requests)
print("connected to io:", io)
# get feed
picowHumid_feed = io.get_feed("distance")
Code: Select all
>>> %Run -c $EDITOR_CONTENT
IP address is 192.168.178.58
connected to io: <IO_HTTP object at 0x20017250>
Traceback (most recent call last):
File "<stdin>", line 58, in <module>
File "adafruit_io/adafruit_io.py", line 707, in get_feed
File "adafruit_io/adafruit_io.py", line 555, in _get
File "adafruit_requests.py", line 730, in get
File "adafruit_requests.py", line 673, in request
File "adafruit_requests.py", line 600, in _send_request
AttributeError: 'NoneType' object has no attribute 'encode'