From 57606539817d1bbe10c9a946f969e9c5956ced51 Mon Sep 17 00:00:00 2001 From: Catherine Johnson <7460658+cjgeode@users.noreply.github.com> Date: Fri, 12 Oct 2018 10:24:47 -0700 Subject: [PATCH] added get_activity Added a convenience method for getting the activities for a given day for a user. --- fitbit/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fitbit/api.py b/fitbit/api.py index ba9d037..66d0fe6 100644 --- a/fitbit/api.py +++ b/fitbit/api.py @@ -618,6 +618,18 @@ def activity_stats(self, user_id=None, qualifier=''): ) return self.make_request(url) + def get_activity(self, date, user_id=None): + """ + This gets the activities for a given day for the current user + Date should be 'YYYY-MM-DD' + https://dev.fitbit.com/build/reference/web-api/activity/#get-daily-activity-summary + """ + user_id= self._get_common_args(user_id) + url = "{0}/{1}/user/-/activities/date/{date}.json".format( + *self._get_common_args(user_id), + date=date) + return self.make_request(url) + def _food_stats(self, user_id=None, qualifier=''): """ This builds the convenience methods on initialization::