campbellr / flow-client

A python client library to interact with Polar Flow
Apache License 2.0
10 stars 3 forks source link

==== 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

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:

.. code-block:: python

>>> 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:

.. code-block:: python

>>> 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_.

.. _Polar Flow: https://flow.polar.com .. _issue tracker: https://github.com/campbellr/flow-client/issues .. _Polar AccessLink API: https://www.polar.com/en/accesslink