Skip to content

Instantly share code, notes, and snippets.

@paulosman
Created March 27, 2012 20:54
Show Gist options
  • Save paulosman/2220157 to your computer and use it in GitHub Desktop.
Save paulosman/2220157 to your computer and use it in GitHub Desktop.
Quick untested bottle example
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