The FIT (Flexible and Interoperable Data Transfer) file protocol is specified by ANT in its FIT SDK. It’s a common file format used internally on embedded fitness computers, for example on the Edge and Forerunner series of Garmin products.
Navigate to dtcooper/python-fitparse on github and clone the latest version:
$ git clone firstname.lastname@example.org:dtcooper/python-fitparse.git $ cd python-fitparse $ python setup.py install
The following are required to install fitparse,
If you are looking for information on a specific function, class or method, this part of the documentation is for you.
Here’s a simple program to print all the record fields in an activity file:
from fitparse import FitFile fitfile = FitFile('/home/dave/garmin-activities/2012-12-19-16-14-54.fit') # Get all data messages that are of type record for record in fitfile.get_messages('record'): # Go through all the data entries in this record for record_data in record: # Print the records name and value (and units if it has any) if record_data.units: print " * %s: %s %s" % ( record_data.name, record_data.value, record_data.units, ) else: print " * %s: %s" % (record_data.name, record_data.value) print
Copyright (c) 2011-2013, David Cooper <email@example.com> All rights reserved. Dedicated to Kate Lacey Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice, the above dedication, and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.