Created
March 27, 2012 20:54
-
-
Save paulosman/2220157 to your computer and use it in GitHub Desktop.
Quick untested bottle example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import soundcloud | |
from bottle import get, post, redirect, request | |
def soundcloud_client(): | |
return soundcloud.Client( | |
client_id='YOUR_CLIENT_ID', | |
client_secret='YOUR_CLIENT_SECRET', | |
redirect_uri='http://localhost:3000/soundcloud/connected' | |
) | |
@post('/login') | |
def login(): | |
client = soundcloud_client() | |
return redirect(client.authorize_url()) | |
@get('/soundcloud/connected') | |
def callback(): | |
code = request.query.code | |
client = soundcloud_client() | |
access_token = client.exchange_token(code) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment