API Reference¶
Authentication¶
-
class
kiefer.auth.
KieferAuth
(config_path)¶ Takes care of authentication with the Jawbone UP API. The provided config file needs to include these 4 values:
client_id
client_secret
redirect_uri
scope
Additionally,
access_token
andrefresh_token
will be recognized during initialization, if provided. This is helpful to retrieve the refresh token or to refresh your access token.Parameters: config_path – str
, path to config file.-
get_access_token
()¶ Use this method to retrieve your access token.
Returns: access_token
-
get_refresh_token
()¶ Get refresh token.
Returns: refresh token
-
refresh_access_token
()¶ Refresh your (expired) access token.
The KieferAuth instance needs a valid access token and refresh token. Use
set_access_token()
andset_refresh_token()
for that. Alternatively, you can addaccess_token
andrefresh_token
as keys to your config file.Returns: access token
-
set_access_token
(token)¶ Set access token.
Parameters: token – str
-
set_refresh_token
(token)¶ Set refresh token.
Parameters: token – str
Client¶
-
class
kiefer.client.
KieferClient
(access_token)¶ Client class for the Jawbone UP API.
Parameters: access_token – Your access token for the UP API. -
add_body_event
(**kwargs)¶ Add body event (weight).
Values for **kwargs:
- title:
str
- weight:
float
(required) - body_fat:
float
- lean_mass: float`
- bmi:
float
- note:
str
- time_created:
int
- tz:
str
- share:
bool
- title:
-
add_meal
(**kwargs)¶ Add a new meal.
Possible values for kwargs are:
- note:
str
- sub_type:
int
(1
= Breakfast,2
= Lunch,3
= Dinner) - place_lat:
float
- place_lon:
float
- place_acc:
float
- place_name:
str
- time_created:
int
- tz:
str
- items:
dict
(For details refer to: https://jawbone.com/up/developer/endpoints/meals#post_meal)
- note:
-
add_mood
(**kwargs)¶ Add a new mood.
Possible values for kwargs are:
- title:
str
- sub_type:
int
(1
= Amazing,2
= Pumped UP,3
= Energized,8
= Good,4
= Meh,5
= Dragging,6
= Exhausted,7
= Totally Done) - time_created:
int
- tz:
str
- share:
bool
- title:
-
add_sleep
(**kwargs)¶ Add a new sleep.
Possible values for kwargs are:
- time_created:
int
- time_completed:
int
- tz:
str
- share:
bool
- time_created:
-
add_workout
(**kwargs)¶ Add a new workout.
Possible values for kwargs are:
- sub_type:
int
(refer to https://jawbone.com/up/developer/endpoints/workouts#post_workout for list of values) - time_created:
int
- time_completed:
int
- place_lat:
float
- place_lon:
float
- place_acc:
float
- place_name:
str
- tz:
str
- share:
bool
- calories:
int
- distance:
int
- image_url:
str
- intensity:
int
(1
= easy,2
= moderate,3
= intermediate,4
= difficult,5
= hard)
- sub_type:
-
delete_body_event
(xid)¶ Delete a body event.
Parameters: xid – str
, id of body event
-
delete_meal
(xid)¶ Delete a meal.
Parameters: xid – str
, meal id
-
delete_mood
(xid)¶ Delete a mood.
Parameters: xid – str
, mood id
-
delete_sleep
(xid)¶ Delete a sleep.
Parameters: xid – str
, sleep id
-
get_band_events
()¶ Get list of band hardware events.
-
get_body_event
(xid)¶ Get a single body event.
Parameters: xid – str
, id of body event
-
get_body_events
(**kwargs)¶ Get list of body events.
-
get_custom_events
(**kwargs)¶ Get list of custom/generic events.
-
get_goals
()¶ Get list of goals.
-
get_heart_rates
(**kwargs)¶ Get list of heart rates.
-
get_meal
(xid)¶ Get a single meal.
Parameters: xid – str
, meal id
-
get_meals
(**kwargs)¶ Get list of meals.
-
get_mood
(xid)¶ Get a single mood.
Parameters: xid – str
, id of mood
-
get_moods
(**kwargs)¶ Get list of moods.
-
get_move
(xid)¶ Get a single move.
Parameters: xid – str
, move id
-
get_move_graph
(xid)¶ Get graph of a single move.
Parameters: xid – str
, move id
-
get_move_ticks
(xid)¶ Get ticks of a single move.
Parameters: xid – str
, move id
-
get_moves
(**kwargs)¶ Get list of moves.
-
get_settings
()¶ Retrieve user settings.
-
get_sleep
(xid)¶ Get a single sleep.
Parameters: xid – str
, id of sleep
-
get_sleep_graph
(xid)¶ Get graph of a single sleep.
Parameters: xid – str
, sleep id
-
get_sleep_phases
(xid)¶ Get sleep phases of a single sleep.
Parameters: xid – str
, sleep id
-
get_sleeps
(**kwargs)¶ Get list of sleeps.
-
get_timezone
(**kwargs)¶ Get user time zone.
-
get_trends
(**kwargs)¶ Get trends.
-
get_user_friends
()¶ Get list of the user’s friends.
-
get_user_information
()¶ Get basic information of the user.
-
get_workout
(xid)¶ Get a single workout.
Parameters: xid – str
, id of workout
-
get_workout_graph
(xid)¶ Get graph for a single workout.
Parameters: xid – str
, workout id
-
get_workout_ticks
(xid)¶ Get ticks for a single workout.
Parameters: xid – str
, workout id
-
get_workouts
(**kwargs)¶ Get list of workouts.
-
update_goal
(**kwargs)¶ Creates or updates an user’s goal(s).
Possible values for kwargs are:
- move_steps:
int
- sleep_total:
int
- body_weight:
float
- body_weight_intent:
int
(0
= lose,1
= maintain,2
= gain)
- move_steps:
-
update_meal
(xid, **kwargs)¶ Updates an existing meal.
Refer to
add_meal()
for a list of keyword arguments.Parameters: xid – str
, id of meal
-
update_workout
(xid, **kwargs)¶ Updates an existing workout.
Refer to
add_workout()
for a list of keyword arguments.Parameters: xid – str
, workout id
-