Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Jawbone UP API python wrapper

Project description

JawboneUP API

This is a wrapper for the Jawbone UP API. It has convenience methods for auth, access token, refresh token, and api calls.

For terminologies, refer to the documentation here:


from jawbone import Jawbone jb = Jawbone(client_id, client_secret, redirect_uri, scope=’‘)

The app can be authorized for accessing specific data using the “scope” The parameter “scope”, by default is ‘basic_read’, which can be set as per the application’s requirements. Multiple scopes can be authorized by using space delimiters.

To see the list of available scopes, refer: (under the heading The “scopes” allowed by the system are)

So, to use the package:

  1. Initialization:

    jb = Jawbone(client_id, client_secret, redirect_uri, scope=’basic_read extended_read’)

To make calls on behalf of the user, refer this documentation:

To get the authorization token:


This call fetches the authentication URL. You should redirect the user to the generated authentication url. Upon successful authorization, the user is redirected to the “redirect_uri” specified. The “code” is specified as a GET parameter.

If there was an error, the response would be to the “redirect_uri” with GET parameter “error”

  1. Access Token

Once we have the code, you can get the auth code by calling

token = jb.access_token(code)

Save the generated token response json.

The response, if 200 has the following components as json:

access_token, token_type, expires_at, refresh_token

Store these in the database, for future api calls.

  1. Refresh Token

The generated token from the above step has an expiry of 1 year. The refresh token provided as a part of the access_token() call, can be used to obtain the new credentials

response = jb.refresh_token_call(refresh_code)
  1. API Calls

api_call is a generic method for calling any endpoint. Documentation on endpoints here:

To make an API call to get sleep data:

endpoint = nudge/api/v.1.0/sleep response = jb.api_call(access_token, endpoint)

A response is a json with status_code (200, 400, etc). Parse the json for the response data If response.status == 200, the response.get(“error”) contains the message.

The library dependencies include:

urllib requests

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
jawbone-up-0.1.tar.gz (2.5 kB) Copy SHA256 hash SHA256 Source None Mar 31, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page