Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aiguofer/py-trace
Python client for interacting with the Trace Action Sports Tracker API
https://github.com/aiguofer/py-trace
alpinereplay api-client python skiing snowboarding trace traceup tracker
Last synced: about 1 month ago
JSON representation
Python client for interacting with the Trace Action Sports Tracker API
- Host: GitHub
- URL: https://github.com/aiguofer/py-trace
- Owner: aiguofer
- License: mit
- Created: 2018-07-24T01:54:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:38:03.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T14:42:14.455Z (7 months ago)
- Topics: alpinereplay, api-client, python, skiing, snowboarding, trace, traceup, tracker
- Language: Python
- Size: 20.5 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
===================
Trace Python Client
===================.. image:: https://img.shields.io/pypi/v/py-trace.svg
:target: https://pypi.python.org/pypi/py-trace.. image:: https://img.shields.io/travis/aiguofer/py-trace.svg
:target: https://travis-ci.org/aiguofer/py-trace.. image:: https://readthedocs.org/projects/py-trace/badge/?version=latest
:target: https://py-trace.readthedocs.io/en/latest/?badge=latest
:alt: Documentation StatusPython client for interacting with the Trace api. For information on the API see `the api documentation `_
* Free software: MIT license
* Documentation: https://py-trace.readthedocs.io.Getting Started
---------------To use in REPL or a non-GUI app:
.. code-block:: python
from py_trace import Trace
client = Trace(, )
client.get_authorization_url()
# output should be like https://www.alpinereplay.com/api/oauth_login?oauth_token=, go to the url and authorize the app
# after authorization, you should see a url like http://snow.traceup.com/api/oauth_login?oauth_token=&oauth_verifier=
client.get_access_token()
client.get_user()To use in a web app (using a very basic Flask example):
.. code-block:: python
from flask import Flask, request, redirect
import jsonapp = Flask(__name__)
trace = Trace(, , 'http://127.0.0.1:5000/auth_callback')@app.route('/auth_callback')
def handle_redirect():
trace.get_access_token(request.args['oauth_verifier'])
return redirect('/user')@app.route('/auth')
def get_user_token():
url = trace.get_auth_url()
return redirect(url)@app.route('/user')
def get_user():
return json.dumps(trace.get_user())Credits
-------This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage