misfit package¶
Misfit API Python Client Implementation. Facilitates connection to Misfit’s REST API and retrieving user data.
Submodules¶
misfit.auth module¶
-
class
misfit.auth.
MisfitAuth
(client_id, client_secret, redirect_uri='http://127.0.0.1:8080/', state=None, scope=['public', 'birthday', 'email'], success_html=None, failure_html=None)[source]¶ Build the authorization url and save the state. Return the authorization url
-
fetch_token
(code, state)[source]¶ Fetch the token, using the verification code. Also, make sure the state received in the response matches the one in the request. Returns the access_token.
Open a browser to the authorization url and spool up a CherryPy server to accept the response
misfit.misfit module¶
-
class
misfit.misfit.
MisfitObject
(data)[source]¶ Bases:
misfit.misfit.UnicodeMixin
-
class
misfit.misfit.
MisfitProfile
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitDevice
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitGoal
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitSummary
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitSession
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitSleepDetail
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
-
class
misfit.misfit.
MisfitSleep
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
misfit.cli module¶
Usage:
misfit authorize --client_id=<client_id> --client_secret=<client_secret> [--config=<config_file>]
misfit profile [--user_id=<user_id>] [--object_id=<object_id>] [--config=<config_file>]
misfit device [--user_id=<user_id>] [--object_id=<object_id>] [--config=<config_file>]
misfit goal (--start_date=<start_date> --end_date=<end_date>|--object_id=<object_id>) [--user_id=<user_id>] [--config=<config_file>]
misfit summary --start_date=<start_date> --end_date=<end_date> [--detail] [--user_id=<user_id>] [--config=<config_file>]
misfit session (--start_date=<start_date> --end_date=<end_date>|--object_id=<object_id>) [--user_id=<user_id>] [--config=<config_file>]
misfit sleep (--start_date=<start_date> --end_date=<end_date>|--object_id=<object_id>) [--user_id=<user_id>] [--config=<config_file>]
misfit --version
misfit --help
Options:
-h --help Show this screen.
--version Show version.
--client_id=<client_id> App key of your Misfit app.
--client_secret=<client_secret> App secret of your Misfit app.
--config=<config_file> Use the config file specified [default: ./misfit.cfg]
--user_id=<user_id> Misfit User ID.
--object_id=<object_id> ID of a single Misfit object.
--start_date=<start_date Date at the start of a range: Eg. 2014-11-20.
--end_date=<end_date> Date at the end of a range: Eg. 2014-11-30.
--detail If specified, print summary detail for each day.
misfit.notification module¶
-
class
misfit.notification.
MisfitMessage
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
DELETED, CREATED and UPDATED are the three known actions you will find in the
action
property-
DELETED
= 'deleted'¶
-
CREATED
= 'created'¶
-
UPDATED
= 'updated'¶
-
-
class
misfit.notification.
MisfitNotification
(data)[source]¶ Bases:
misfit.misfit.MisfitObject
misfit.exceptions module¶
-
exception
misfit.exceptions.
MisfitHttpException
(code, message, response=None)[source]¶ Bases:
misfit.exceptions.MisfitException
Base class for all HTTP exceptions raised by the Misfit API. All exceptions will have three attributes.
- code: The status code of the HTTP response, defaults to 500
- message: The messages returned from the Misfit API
- response: If we have one, this attribute will be the response object, of
type
requests.models.Response
. It’s useful to have access to this because each response contains useful headers. For example, if the library throws an exception of typeMisfitRateLimitError
you can retrieve a time stamp for when the rate limit resets with the following code:exc.response.headers['x-ratelimit-reset']