campbellr / flow-client

A python client library to interact with Polar Flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flow

A python client for Polar Flow.

NOTE: This project was created before Polar opened their Polar AccessLink API. You are much better off using that. An official python example can be found at https://github.com/polarofficial/accesslink-example-python

Features

  • Fetch a list of activities within given date range
  • Fetch the TCX file for any training session
  • Fetch raw training session data (TODO)
  • Fetch activity data (steps, goal, etc...) (TODO)

Install

This package isn't on PyPi yet, so the easiest way to install is directly from the git repository:

$ pip install git+git://github.com/campbellr/flow-client.git

Usage

Usage is fairly simple. Simply instantiate a FlowClient, login with your Polar Flow credentials and fetch activities with the activities method:

>>> from flow import FlowClient
>>>
>>> client = FlowClient()
>>> client.login('username@example.com', 'password')
>>> # no arguments will fetch all activities in the last 30 days
>>> activity = client.activities()[0]
>>> print activity
Activity(63464689)
>>> print activity.type
EXERCISE
>>> print activity.datetime
2015-03-10T19:38:18.000Z
>>> print activity.distance
4964.10009766

The entire list of attributes of an Activity can be viewed using dir.

Finally, you can download the tcx file for a given activity with the Activty.tcx method:

  >>> print activity.tcx()
  <?xml version="1.0" encoding="UTF-8"?><TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"><Activities><Activity Sport="Running"><Id>2015-03-10T19:38:18.000Z</Id><Lap StartTime="2015-03-10T19:38:18.000Z"><TotalTimeSeconds>426.0</TotalTimeSeconds><DistanceMeters>1000.0</DistanceMeters>
[...]

Contributing

Contributions are greatly appreciated! Feel free to submit a pull request, or file an issue in our issue tracker.

About

A python client library to interact with Polar Flow

License:Apache License 2.0


Languages

Language:Python 100.0%