shankar1093 / biker Goto Github PK
View Code? Open in Web Editor NEWHack the planet: Fitness add in for motor cycle riding.
License: MIT License
Hack the planet: Fitness add in for motor cycle riding.
License: MIT License
NOTE: There is a bug in the PyPi version of this library. Instead of from jawbone import Jawbone Just do from jawbone.jawbone import Jawbone There are a few other bugs like https: v/s http: header, which would resolve soon (hopefully :) ) Or just include this version (on github) and add the following line in __init__.py from .jawbone import Jawbone 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: https://jawbone.com/up/developer/authentication Usage: 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: https://jawbone.com/up/developer/authentication (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: https://jawbone.com/up/developer/authentication To get the authorization token: jb.auth() 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” 2. 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. 3. 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) 4. API Calls api_call is a generic method for calling any endpoint. Documentation on endpoints here: https://jawbone.com/up/developer/endpoints 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.