adafruit / Adafruit_Learning_System_Guides

Programs and scripts to display "inline" in Adafruit Learning System guides

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ikea Vindriktning auth / exception

mikeysklar opened this issue · comments

Two suggested changes to make the Ikea Vindriktning example script working out of the box.

  1. Change from lowercase to upper when accessing settings.toml values like this:
# aio_username = os.getenv('aio_username')
# aio_key = os.getenv('aio_key')
aio_username = os.getenv("ADAFRUIT_IO_USERNAME")
aio_key = os.getenv("ADAFRUIT_IO_KEY")
  1. exception AdafruitIO_RequestError needs to be removed or changed

change this:


try:                               
# get feed                       
    ikea_pm25 = io.get_feed("ikeapm25")
except AdafruitIO_RequestError:         
# if no feed exists, create one
    ikea_pm25 = io.create_new_feed("ikeapm25") 

to this:


try:                               
# get feed                       
    ikea_pm25 = io.get_feed("ikeapm25")
except:         
# if no feed exists, create one
    ikea_pm25 = io.create_new_feed("ikeapm25") 

forum thread where this was found:

https://forums.adafruit.com/viewtopic.php?t=204719

commented

thanks! merged in