File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
- # Google OAuth2.0 Workflow for MagTag
1
+ # SPDX-FileCopyrightText: 2021 Brent Rubell, written for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: Unlicense
2
4
import ssl
3
5
import board
4
6
import wifi
27
29
pool = socketpool .SocketPool (wifi .radio )
28
30
requests = requests .Session (pool , ssl .create_default_context ())
29
31
32
+ # DisplayIO setup
30
33
font_small = bitmap_font .load_font ("/fonts/Arial-12.pcf" )
31
34
font_large = bitmap_font .load_font ("/fonts/Arial-14.pcf" )
32
35
Original file line number Diff line number Diff line change 1
- # MagTag Google Calendar Event Viewer
2
- # Brent Rubell for Adafruit Industries, 2021
1
+ # SPDX-FileCopyrightText: 2021 Brent Rubell, written for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: Unlicense
3
4
import time
4
5
import ssl
5
6
import board
55
56
pool = socketpool .SocketPool (wifi .radio )
56
57
requests = requests .Session (pool , ssl .create_default_context ())
57
58
58
- magtag = MagTag ()
59
- r = rtc .RTC ()
60
-
61
59
# Initialize an OAuth2 object with GCal API scope
62
60
scopes = ["https://www.googleapis.com/auth/calendar.readonly" ]
63
61
google_auth = OAuth2 (
69
67
secrets ["google_refresh_token" ],
70
68
)
71
69
72
- if not google_auth .refresh_access_token ():
73
- raise RuntimeError ("Unable to refresh access token - has the token been revoked?" )
74
70
75
71
def get_current_time (time_max = False ):
76
72
"""Gets local time from Adafruit IO and converts to RFC3339 timestamp."""
@@ -189,6 +185,11 @@ def display_calendar_events(resp_events):
189
185
)
190
186
magtag .splash .append (label_event_desc )
191
187
188
+
189
+ # Create a new MagTag object
190
+ magtag = MagTag ()
191
+ r = rtc .RTC ()
192
+
192
193
# DisplayIO Setup
193
194
magtag .set_background (0xFFFFFF )
194
195
You can’t perform that action at this time.
0 commit comments