A Python client for the Smashrun API
Project description
A Python client for the Smashrun API.
Install
You can install the current development release using pip:
pip install --pre smashrun-client
Usage
Authentication
Using an existing refresh token
client = Smashrun(client_id='my_client_id', client_secret='my_secret')
client.refresh_token(refresh_token='my_refresh_token')
Requesting a token
# use urn:ietf:wg:oauth:2.0:oob for applications that aren't a web app
client = Smashrun(client_id='my_client_id',
redirect_uri='urn:ietf:wg:oauth:2.0:auto')
auth_url = client.get_auth_url()
code = input("Go to '%s' and authorize this application. Paste the provided code here:" % auth_url)
client.fetch_token(code=code)
Fetching activities
Use Smashrun.get_activities to get a list of activities (summaries):
activities = client.get_activities() # returns an iterator that handles paginating through the API
for activity in activities:
print activity['startDateTimeLocal']
Fetch a specific activity
Use Smashrun.get_activity to get a specific activity:
activity = client.get_activity(1234)
print activity['recordingKeys']
For more details on what you can do, see the code and the Smashrun API
Contributing
Contributions are greatly appreciated! Feel free to submit a pull request, or file an issue in our issue tracker.
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
smashrun-client-0.1.1.tar.gz
(9.2 kB
view hashes)
Built Distribution
Close
Hashes for smashrun_client-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73b956fc895b07ce5e43b3b36659ab77c660c3b02ec1728366b19aea685f7d85 |
|
MD5 | f072ebb772f13038070878c5caf88011 |
|
BLAKE2b-256 | 2e97767281fe2ba3daebf38f6e393c898d524a5b8c85f6cf78ed3284391f4de9 |