Skip to content

Instantly share code, notes, and snippets.

@dreamiurg
Created May 8, 2018 21:37
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 dreamiurg/c7d0afc12065d7a9262bd398335e307b to your computer and use it in GitHub Desktop.
Save dreamiurg/c7d0afc12065d7a9262bd398335e307b to your computer and use it in GitHub Desktop.
import requests
import arrow
LOGIN_URL = 'https://strengthlevel.com/signin-or-register'
BASE_LIFT_URL = 'https://strengthlevel.com/XXX-lifter'
def login(session):
data = {
'email': r'XXX',
'password': r'XXX',
'action': r'signin'
}
r = session.post('https://strengthlevel.com/signin-or-register', data)
def add_lift(session, lift, date, weight, reps, sets=1):
url = BASE_LIFT_URL + '/' + lift
d = arrow.get(date, 'YYYY-MM-DD').date()
data = {
'liftmass': weight,
'liftmassunit': 'lb',
'repetitions': reps,
'sets': sets,
'date': d,
'timezone': -7,
'addlift': 'Add Lift'
}
print('Adding {}x{} @ {}lb on {} for {}'.format(reps, sets, weight, d, lift))
r = session.post(url, data)
print(r)
def run():
s = requests.Session()
s.cookies.clear()
login(s)
add_lift(s, 'bench-press', '2016-12-12', 130, 5, 1)
add_lift(s, 'deadlift', '2018-04-30', 310, 5)
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment