A package for fetching data from Zwiftpower
Reason this release was yanked:
buggy json output (single-quotes)
Project description
zpdatafetch
A python library for fetching data from zwiftpower
Installation
pip install zpdatafetch
Usage
zpdatafetch comes with a command-line tool named zpdata. This can be used to fetch data directly from zwiftpower. It sends the json response to stdout. It also acts as a guide for how to use the library in your own program.
For both command-line and library usage, you will need to have a zwiftpower account. You will need set up your credentials in the keyring. This can be done using the following commands:
keyring set zpdatafetch username
keyring set zpdatafetch password
Command-line example
usage: zpdata [-h] [--verbose] [{config,cyclist,primes,result,signup,team}] [id ...]
Module for fetching zwiftpower data using the Zwifpower API
positional arguments:
{config,cyclist,primes,result,signup,team}
which command to run
id the id to search for, ignored for config
options:
-h, --help show this help message and exit
-v, --verbose provide feedback while running
Library example
from zpdatafetch import Cyclist
c = Cyclist()
c.verbose = True
c.fetch(12345) # fetch data for cyclist with zwift id 12345
print(c.raw)
The interface for each of the objects is effectively the same as the example above, with the individual class and id number changed as appropriate. The available classes are as follows:
- Cyclist: fetch one or more cyclists by zwift id
- Primes: fetch primes from one or more races using event id
- Result: fetch results from one or more races (finish, points) using event id
- Signup: fetch signups for a particular event by event id
- Team: fetch team data by team id
The classes ZP class is the main driver for the library. It is used to fetch the data from zwiftpower. The other classes are used to parse the data into a more useful format.
development
- Install this package
- Install the requirements
pip install -r requirements.txt
- Set up your keyring. You may want to use a separate account on zwiftpower for this.
keyring set zpdatafetch username
keyring set zpdatafetch password
- Run the downloader
PYTHONPATH=`pwd`/src python src/zpdatafetch/zp.py
Cyclist example
PYTHONPATH=`pwd`/src python src/zpdatafetch/cyclist.py -v -r <zwift_id>
Team example
PYTHONPATH=`pwd`/src python src/zpdatafetch/team.py -v -r <team_id>
Signup example
PYTHONPATH=`pwd`/src python src/zpdatafetch/signup.py -v -r <race_id>
Result example
PYTHONPATH=`pwd`/src python src/zpdatafetch/result.py -v -r <race_id>
Primes example
PYTHONPATH=`pwd`/src python src/zpdatafetch/primes.py -v -r <race_id>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file zpdatafetch-1.0.0.tar.gz.
File metadata
- Download URL: zpdatafetch-1.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
925501d54cd41b9d89935badc365e828c873211cedf307c257fbcd3f6178a8d8
|
|
| MD5 |
d8649d0a17a3cb6c9f1b5ba2691a7116
|
|
| BLAKE2b-256 |
dab225633d5837b6e5263d9510316095332bd02da7cfca30f747db3bbc938cae
|