Skip to main content

A Python client for the Smashrun API

Project description

https://travis-ci.org/campbellr/smashrun-client.svg?branch=master

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',client_secret='my_secret',
                  redirect_uri='urn:ietf:wg:oauth:2.0:auto')
auth_url = client.get_auth_url()
code = raw_input("Go to '%s' and authorize this application. Paste the provided code here:" % auth_url[0])
response = client.fetch_token(code=code)
print(response['refresh_token'])

NOTE: The example above assumes that you are running Python 2.x. If You are using Python 3.x you can replace raw_input with input.

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


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.6.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

smashrun_client-0.6.0-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file smashrun-client-0.6.0.tar.gz.

File metadata

  • Download URL: smashrun-client-0.6.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for smashrun-client-0.6.0.tar.gz
Algorithm Hash digest
SHA256 5db27f7458964a9fb3e036d5b211f799f6db15258afa91f52eb1694ef212fd1d
MD5 1f21ce8c503914119155eb7edac9e48e
BLAKE2b-256 fa478f6ed4efc32996d82bbe40b3606426cd0ededca47e3a1795980b7f6bf172

See more details on using hashes here.

File details

Details for the file smashrun_client-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: smashrun_client-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for smashrun_client-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23ad771941053b488548d0b8ab5191d14d3727cefe5a1d4d62564f234d528caf
MD5 855cee76eddbafba134d3acfd1e0ecac
BLAKE2b-256 19c25b17f4cc65662fdb1ab0f1418bb61792ef8d8b12f9cb45fc84f7e1ad3453

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page