Polar AccessLink API Client
Library to enable access to Polar training data through the Polar Open AccessLink API. This library is a forked and packaged version of the offical Polar AccessLink example client.
- Free software: MIT license
Prerequisites
- Polar Flow account
Getting Started
1. Create new API client
Navigate to https://admin.polaraccesslink.com. Log in with your Polar Flow account and create a new client using an appropriate OAuth2 callback URL for your application. Note the client ID and client secret -- you will need these later.
2. Authorize access
User account needs to be linked to client application before client can get any user data. User is asked for authorization in Polar Flow, and user is redirected back to application callback url with authorization code once user has accepted the request. Navigate to the URL given by get_authorization_url() to authorize the account access.
Sample code:
from accesslink import AccessLink
accesslink = AccessLink(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_url=REDIRECT_URL)
# Navigate the user to the following URL so they can complete the authorization form.
# Code for this will vary by application.
auth_url = accesslink.get_authorization_url()
3. Link user
Your application should handle the callback request appropriately, storing the user ID and access token which will be necessary for later API calls. The user must first be registered with the given access token before additional API calls can be made.
Sample code:
from accesslink import AccessLink
accesslink = AccessLink(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_url=REDIRECT_URL)
authorization_code = request.args.get("code")
token_response = accesslink.get_access_token(authorization_code)
USER_ID = token_response["x_user_id"]
ACCESS_TOKEN = token_response["access_token"]
try:
accesslink.users.register(access_token=ACCESS_TOKEN)
except requests.exceptions.HTTPError as err:
# Error 409 Conflict means that the user has already been registered for this client.
# For most applications, that error can be ignored.
if err.response.status_code != 409:
raise err
4. Access API data
Once user has linked their user account to client application and synchronizes data from Polar device to Polar Flow, application is able to load data.
Sample code:
from accesslink import AccessLink
accesslink = AccessLink(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET)
user_info = accesslink.users.get_information(user_id=USER_ID,
access_token=ACCESS_TOKEN)
Metadata
Release files for polar-accesslink 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| polar_accesslink-0.0.5.tar.gz | 7.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polar_accesslink-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.8 kB
Release files / polar_accesslink-0.0.5.tar.gz
| Download URL | polar_accesslink-0.0.5.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8133960f4880b47db67dc5d4e914c51b9e9446afaebec8348d681a7631aed1a
|
|
BLAKE2b-256 checksum How to use checksums |
24bda928f8601c5c0eedc961d28ca64fc47ec7f7fba7d47119852199dabc5fe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Release files / polar_accesslink-0.0.5-py3-none-any.whl
| Download URL | polar_accesslink-0.0.5-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81d738f282e44be47eb088f66183863cd9440511dd4237784eff27dbd5fd29ff
|
|
BLAKE2b-256 checksum How to use checksums |
214ee939cb52b307c231ca316d6aceb92fae877f257b004efd522e6daf5bf364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Security for polar-accesslink 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.