File tree Expand file tree Collapse file tree
CircuitPython_Mastodon_API_Examples
Scrolling_Alphanumeric_Countdown_Clock Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616# connect to SSID
1717wifi .radio .connect (os .getenv ('WIFI_SSID' ), os .getenv ('WIFI_PASSWORD' ))
1818
19- # add your mastodon token as 'mastodon_token' to your .env file
19+ # add your mastodon token as 'mastodon_token' to your settings.toml file
2020headers = {'Authorization' : 'Bearer ' + os .getenv ('mastodon_token' ) + 'read:statuses' }
2121
2222pool = socketpool .SocketPool (wifi .radio )
2323requests = adafruit_requests .Session (pool , ssl .create_default_context ())
2424
2525# initial request, gets most recent matching hashtag post
26- # add your mastodon instance (mastodon.social, tech.lgbt, etc) to your .env file as mastodon_host
26+ # add your mastodon instance (mastodon.social, tech.lgbt, etc)
27+ # to your settings.toml file as mastodon_host
2728r = requests .get ("https://%s/api/v1/timelines/tag/%s?limit=1" % (os .getenv ('mastodon_host' ), hashtag ), headers = headers ) # pylint: disable=line-too-long
2829json_data = r .json ()
2930post_id = str (json_data [0 ]['id' ])
Original file line number Diff line number Diff line change 77import socketpool
88import adafruit_requests
99
10- # add your mastodon token as 'mastodon_token' to your .env file
10+ # add your mastodon token as 'mastodon_token' to your settings.toml file
1111headers = {'Authorization' : 'Bearer ' + os .getenv ('mastodon_token' )}
1212
13- # add your mastodon instance to your .env file as mastodon_host
13+ # add your mastodon instance to your settings.toml file as mastodon_host
1414url = 'https://' + os .getenv ('mastodon_host' ) + '/api/v1/statuses'
1515
1616# connect to SSID
Original file line number Diff line number Diff line change 33"""
44CircuitPython Quad-Alphanumeric Display Holiday Countdown.
55
6- This demo requires a separate file named .env (including the dot) on your CIRCUITPY drive, which
6+ This demo requires a separate file named settings.toml on your CIRCUITPY drive, which
77should contain your WiFi credentials and Adafruit IO credentials.
88"""
99
You can’t perform that action at this time.
0 commit comments