Skip to content

Instantly share code, notes, and snippets.

@underyx
Last active July 16, 2018 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save underyx/d35f5d304d0ef1c72c925169a0043fe8 to your computer and use it in GitHub Desktop.
Save underyx/d35f5d304d0ef1c72c925169a0043fe8 to your computer and use it in GitHub Desktop.
Syncs my wanikani review queue length to Beeminder
#!/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