Last active
July 16, 2018 07:14
-
-
Save underyx/d35f5d304d0ef1c72c925169a0043fe8 to your computer and use it in GitHub Desktop.
Syncs my wanikani review queue length to Beeminder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
from os import environ | |
r = requests.get( | |
'https://api.wanikani.com/v2/summary', | |
headers={'Authorization': f'Bearer {environ["WANIKANI_TOKEN"]}'}, | |
) | |
r.raise_for_status() | |
items_to_review = len(r.json()['data']['reviews'][0]['subject_ids']) | |
print(f'Submitting a value of {items_to_review} to Beeminder') | |
r = requests.post( | |
'https://www.beeminder.com/api/v1/users/underyx/goals/process-wanikani-reviews/datapoints.json', | |
data={'value': items_to_review}, | |
params={'auth_token': environ['BEEMINDER_TOKEN']}, | |
) | |
r.raise_for_status() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment