A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://gist.github.com/e3fbd47fbb7ee3c626bb below:

gist:e3fbd47fbb7ee3c626bb · GitHub

Created May 30, 2010 18:52

Clone this repository at <script src="https://gist.github.com/thruflo/e3fbd47fbb7ee3c626bb.js"></script>

Save thruflo/e3fbd47fbb7ee3c626bb to your computer and use it in GitHub Desktop.

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 """n.b.: this is psuedocode, in the sense that you'll need to expose the code written here within `OAuthLogin.get` and `OAuthCallback.get` using your web framework of choice. """ import oauth2 oauth_settings = { 'client_id': '83c01f987ff4b78c6648', 'client_secret': '...', 'base_url': 'https://github.com/login/oauth/', 'redirect_url': 'http://dev.thruflo.com/oauth/callback' } class OAuthLogin(RequestHandler): def get(self): oauth_client = oauth2.Client2( oauth_settings['client_id'], oauth_settings['client_secret'], oauth_settings['base_url'] ) authorization_url = oauth_client.authorization_url( redirect_uri=oauth_settings['redirect_url'], # params={'scope': 'user'} ) logging.debug('authorization_url: %s' % authorization_url) return self.redirect(authorization_url) class OAuthCallback(RequestHandler): def get(self): oauth_client = oauth2.Client2( oauth_settings['client_id'], oauth_settings['client_secret'], oauth_settings['base_url'] ) code = self.get_argument('code') data = oauth_client.access_token(code, oauth_settings['redirect_url']) access_token = data.get('access_token') logging.debug(access_token) (headers, body) = oauth_client.request( 'https://github.com/api/v2/json/user/show', access_token=access_token, token_param='access_token' ) logging.debug(headers.get('status')) logging.debug(body) return body

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4