Merge pull request #2766 from adafruit/dhalbert-patch-2
PyPortal_Youtube: get youtube token from settings.toml
This commit is contained in:
commit
c6b26959c0
1 changed files with 2 additions and 8 deletions
|
|
@ -9,17 +9,11 @@ If you can find something that spits out JSON data, we can display it!
|
|||
|
||||
Requires a youtube API key!
|
||||
"""
|
||||
import os
|
||||
import time
|
||||
import board
|
||||
from adafruit_pyportal import PyPortal
|
||||
|
||||
# Get wifi details and more from a secrets.py file
|
||||
try:
|
||||
from secrets import secrets
|
||||
except ImportError:
|
||||
print("WiFi secrets are kept in secrets.py, please add them there!")
|
||||
raise
|
||||
|
||||
# Set up where we'll be fetching data from
|
||||
CHANNEL_ID = "UCpOlOeQjj7EsVnDh3zuCgsA" # this isn't a secret but you have to look it up
|
||||
#CHANNEL_ID = "UC6p-tjZN8s9GBSbiN4K-bwg"
|
||||
|
|
@ -27,7 +21,7 @@ CAPTION = "www.youtube.com/adafruit"
|
|||
#CAPTION = "www.youtube.com/c/JohnParkMakes"
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
DATA_SOURCE = "https://www.googleapis.com/youtube/v3/channels/?part=statistics&id="+CHANNEL_ID+"&key="+secrets['youtube_token']
|
||||
DATA_SOURCE = "https://www.googleapis.com/youtube/v3/channels/?part=statistics&id="+CHANNEL_ID+"&key="+os.getenv("YOUTUBE_TOKEN")
|
||||
DATA_LOCATION1 = ["items", 0, "statistics", "viewCount"]
|
||||
DATA_LOCATION2 = ["items", 0, "statistics", "subscriberCount"]
|
||||
# pylint: enable=line-too-long
|
||||
|
|
|
|||
Loading…
Reference in a new issue