Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for They said so api token #81

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Running this project is as simple as deploying it to a balenaCloud application.

You can also deploy in the traditional manner using the balena CLI and `balena push` command. For more information [check out the docs](https://www.balena.io/docs/learn/deploy/deployment/).

UPDATE: The Quote of the Day service now requires authentication via API token. Please visit https://theysaidso.com/user/subscriptions to create an account and a token. You can set this token in the Balena deploy phase by selecting the advance setup option and updating the value of QOD_API_TOKEN. You can also set this later using the same process as other environment variables.

## Customization

Your fleet of Inkyshots can all be managed centrally via balenaCloud. Try any of the environment variables below to add some customization.
Expand Down
1 change: 1 addition & 0 deletions balena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ data:
applicationEnvironmentVariables:
- UPDATE_HOUR: 9
- TZ: Europe/London
- QOD_API_TOKEN: MY_TOKEN
- QOD_CATEGORY: inspire
- FONT: AmaticSC
- TEST_CHARACTER: a
Expand Down
3 changes: 2 additions & 1 deletion inkyshot/update-display.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def temp_to_str(temp, scale):
BALENA_DEVICE_UUID = os.environ["BALENA_DEVICE_UUID"]
BALENA_SUPERVISOR_ADDRESS = os.environ["BALENA_SUPERVISOR_ADDRESS"]
BALENA_SUPERVISOR_API_KEY = os.environ["BALENA_SUPERVISOR_API_KEY"]
QOD_API_TOKEN = os.environ["QOD_API_TOKEN"]

WAVESHARE = True if "WAVESHARE" in os.environ else False

Expand Down Expand Up @@ -353,7 +354,7 @@ def temp_to_str(temp, scale):
try:
response = requests.get(
f"https://quotes.rest/qod?category={CATEGORY}&language={LANGUAGE}",
headers={"Accept" : "application/json"}
headers = {"Accept": "application/json", "Authorization": f"Bearer {QOD_API_TOKEN}"}
)
data = response.json()
message = data['contents']['quotes'][0]['quote']
Expand Down
Loading