File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
CircuitPython_Mastodon_API_Examples
Scrolling_Alphanumeric_Countdown_Clock Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 16
16
# connect to SSID
17
17
wifi .radio .connect (os .getenv ('WIFI_SSID' ), os .getenv ('WIFI_PASSWORD' ))
18
18
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
20
20
headers = {'Authorization' : 'Bearer ' + os .getenv ('mastodon_token' ) + 'read:statuses' }
21
21
22
22
pool = socketpool .SocketPool (wifi .radio )
23
23
requests = adafruit_requests .Session (pool , ssl .create_default_context ())
24
24
25
25
# 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
27
28
r = requests .get ("https://%s/api/v1/timelines/tag/%s?limit=1" % (os .getenv ('mastodon_host' ), hashtag ), headers = headers ) # pylint: disable=line-too-long
28
29
json_data = r .json ()
29
30
post_id = str (json_data [0 ]['id' ])
Original file line number Diff line number Diff line change 7
7
import socketpool
8
8
import adafruit_requests
9
9
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
11
11
headers = {'Authorization' : 'Bearer ' + os .getenv ('mastodon_token' )}
12
12
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
14
14
url = 'https://' + os .getenv ('mastodon_host' ) + '/api/v1/statuses'
15
15
16
16
# connect to SSID
Original file line number Diff line number Diff line change 3
3
"""
4
4
CircuitPython Quad-Alphanumeric Display Holiday Countdown.
5
5
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
7
7
should contain your WiFi credentials and Adafruit IO credentials.
8
8
"""
9
9
You can’t perform that action at this time.
0 commit comments