A basic interface to the Intervals.icu system
Project description
Intervals.ICU Python API
This API provides a basic interface to work with the Intervals.ICU. You can obtain further documentation for the Intervals.ICU site by following the instructions from this post.
API functionality is described in the thread above. This API aims to provide all functionality, but there are gaps. Please open an issue (or a PR) for any missing functionality.
Full documentation can be found here
Changelog
0.1.4
Added a strict flag to the Intervals library. This flag tells the library
whether it should validate objects received from the server. If object validation
fails, a TypeError is raised.
This flag was added because updates to the backend objects can unintentionally break client libraries. So you can toggle this flag to stop validating objects.
This flag is True by default, to preserve backwards compatibility. You must
manually set the flag to False to stop validating objects.
Examples
Update a field in your wellness document
import pprint
from datetime import date
from intervalsicu import Intervals
def wellness():
svc = Intervals("MY ATHLETE ID", "MY API KEY", strict=False)
start = date.fromisoformat("2021-03-10")
wellness = svc.wellness(start)
wellness['restingHR'] = 57
wellness = svc.wellness_put(wellness)
pprint.pprint(wellness)
if __name__ == "__main__":
wellness()
Write all your activities to a CSV file
import csv
import io
from intervalsicu import Intervals
def activities_to_csv():
svc = Intervals("MY ATHLETE ID", "MY API KEY", strict=False)
activities_csv = io.StringIO(svc.activities())
with open('example/activities.csv', 'w') as w:
reader = csv.reader(activities_csv)
writer = csv.writer(w)
for row in reader:
writer.writerow(row)
if __name__ == "__main__":
activities_to_csv()
Download a list of events in JSON.
import pprint
from datetime import date
from intervalsicu import Intervals
def events():
svc = Intervals("MY ATHLETE ID", "MY API KEY", strict=False)
start = date.fromisoformat("2021-03-08")
end = date.fromisoformat("2021-03-09")
events = svc.events(start, end)
pprint.pprint(events)
if __name__ == "__main__":
events()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intervalsicu-0.1.4.tar.gz.
File metadata
- Download URL: intervalsicu-0.1.4.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f87005c2d0551108376400552525b951dc452130a1b3ed804d71ea7ca121c6c
|
|
| MD5 |
2295608eda58221f8c0ae767a3eefbed
|
|
| BLAKE2b-256 |
5b0b78a42fd23f42aa5d2fbe563d9a6b795a4a0f450bb7f15582c2cbe3d581ed
|
File details
Details for the file intervalsicu-0.1.4-py3-none-any.whl.
File metadata
- Download URL: intervalsicu-0.1.4-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0c4e40ce5ce6835c81c2df3c5a4a348cda6b30cfffe40e05683b25b0e45335a
|
|
| MD5 |
8952bcb442e09be0e9a284f8d6c0cf88
|
|
| BLAKE2b-256 |
c5610fe6dc294bca3e3031abe5efb28c9d469621ae269f35a9d79c6f1d136d65
|