Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import requests
import shlex
import subprocess
# login to beeminder and visit
auth_token = 'token'
username = 'username'
goal = 'thesis'
url = '{}/goals/{}/datapoints.json'.format(username, goal)
commit = subprocess.check_output(shlex.split('git log -1 --format="%H"')).strip().decode('UTF-8')
cmd = "git show --numstat {} | grep tex | awk '{{sum+=$1+$2}} END {{print sum;}}'"
lines = int(subprocess.check_output(cmd.format(commit), shell=True))
comment = subprocess.check_output(shlex.split("git log -1 --format=%B")).strip().decode('UTF-8')
if lines > 0:
payload = {
"value": lines,
"comment": comment,
"requestid": commit,
"auth_token": auth_token
r =, data=payload)
print('updated beeminder with {} changed lines'.format(lines))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.