python hacks

This page contains links to some of my python hacks. It is autogenerated from the comments (if any) at the head of each file.

macmail(updated Tue Mar 1 22:45:48 2016)
Subdirectory
upload-weight-data-to-fitbit.py(updated Sun Dec 20 19:17:45 2015)
# Upload CSV data to FitBit
#
# CSV data is assumed to be in the form date, weight
# date is in the form YYYY-MM-DD (all numeric, so Jan 1, 1970 is 1970-01-01)
# if your date format is something different, adjust the date parsing to suit.
# weight is treated as a floating-point number; units are determined by config
#
# This script takes one optional parameter, which is the start date for data to
# post. The FitBit API is limited to 150 calls per hour, so if you've got more
# than 150 datapoints to upload there's a good chance it'll do the first 150
# then exit with a rate-limit error. It will include the date for the data it
# was trying to post; you can re-run the script at the top of the next hour
# with this date as the sole parameter, and it'll pick up from where it left
# off. Ideally the script would handle this, but the python library doesn't
# pass back the rate-limiting headers that would allow you to figure out how
# long to wait before running again, so I didn't bother.
#
# config file is $HOME/.api_keys (because I started out with a Perl library that
# used this path). Contents:
#
# [fitbit]
# fitbit_uploader_oauth_consumer_key=X
# fitbit_uploader_oauth_shared_secret=Y
# oauth_token=A
# oauth_token_secret=B
# unit_system=U
#
# set U appropriately per https://dev.fitbit.com/docs/basics/#units.
#
# X and Y you get by registering an application at
# https://dev.fitbit.com/apps/new
#
# A and B are messier; the python-fitbit code comes with a gather_keys_cli.py
# script which you can run with values X and Y as parameters; it'll open a
# browser window where you authorise access, then it'll dump out a bunch of
# values containing encoded_user_id and the two oauth_token values. Insert them
# into .api_keys and you should be ready to go.
#



Waider Ugh. Did I write that?