當前位置: 首頁>>代碼示例>>Python>>正文


Python rauth.OAuth2Service方法代碼示例

本文整理匯總了Python中rauth.OAuth2Service方法的典型用法代碼示例。如果您正苦於以下問題:Python rauth.OAuth2Service方法的具體用法?Python rauth.OAuth2Service怎麽用?Python rauth.OAuth2Service使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rauth的用法示例。


在下文中一共展示了rauth.OAuth2Service方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_access_token

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def get_access_token(self, code, *vargs, **kwargs):
        long_term = kwargs.get('long_term', False)
        if 'long_term' in kwargs:
            del kwargs['long_term']

        data = dict(
            code=code,
            grant_type='authorization_code', 
            redirect_uri=self.redirect_uri, 
            )
        data.update(kwargs.get('data', {}))
        kwargs['data'] = data
        token = super(OAuth2Service, self).get_access_token(
            *vargs, **kwargs)

        if long_term:
            token = self.get_long_term_token(token)

        return token 
開發者ID:debrouwere,項目名稱:facebook-insights,代碼行數:21,代碼來源:oauth.py

示例2: get_oauth_services

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def get_oauth_services():
    oauth_services = {}
    oauth_services['google'] = OAuth2Service(**oauth_config(current_app.config, 'google'))
    oauth_services['github'] = OAuth2Service(**oauth_config(current_app.config, 'github'))
    return oauth_services 
開發者ID:DoubleCiti,項目名稱:daimaduan.com,代碼行數:7,代碼來源:sites.py

示例3: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def __init__(self):
        super(FacebookSignIn, self).__init__('facebook')
        self.service = OAuth2Service(
            name='facebook',
            client_id=self.consumer_id,
            client_secret=self.consumer_secret,
            authorize_url='https://graph.facebook.com/oauth/authorize',
            access_token_url='https://graph.facebook.com/oauth/access_token',
            base_url='https://graph.facebook.com/'
        ) 
開發者ID:miguelgrinberg,項目名稱:flask-oauth-example,代碼行數:12,代碼來源:oauth.py

示例4: init

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def init(client_id, client_secret, session_key='musicbrainz'):
    global _musicbrainz, _session_key
    _musicbrainz = OAuth2Service(
        name='musicbrainz',
        base_url="https://musicbrainz.org/",
        authorize_url="https://musicbrainz.org/oauth2/authorize",
        access_token_url="https://musicbrainz.org/oauth2/token",
        client_id=client_id,
        client_secret=client_secret,
    )
    _session_key = session_key 
開發者ID:metabrainz,項目名稱:listenbrainz-server,代碼行數:13,代碼來源:provider.py

示例5: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def __init__(self, current_app):
        google_params = self._get_google_info()
        self.service = OAuth2Service(
            name='google',
            client_id=conf.login['GOOGLE_LOGIN_CLIENT_ID'],
            client_secret=conf.login['GOOGLE_LOGIN_CLIENT_SECRET'],
            authorize_url=google_params.get('authorization_endpoint'),
            base_url=google_params.get('userinfo_endpoint'),
            access_token_url=google_params.get('token_endpoint')
        ) 
開發者ID:statgen,項目名稱:pheweb,代碼行數:12,代碼來源:auth.py

示例6: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def __init__(self, keyfile, tokenfile=None,
                 base_url="https://fantasysports.yahooapis.com",
                 request_period=0):

        self.key = ClientKey.from_file(keyfile)

        self.tokenfile = tokenfile
        if self.tokenfile and os.path.exists(self.tokenfile):
            self.token = Token.from_file(self.tokenfile)
        else:
            self.token = Token()

        self.oauth = OAuth2Service(
            client_id=self.key.client_id,
            client_secret=self.key.client_secret,
            name="yahoo",
            authorize_url="https://api.login.yahoo.com/oauth2/request_auth",
            access_token_url="https://api.login.yahoo.com/oauth2/get_token",
            base_url=base_url,
        )

        self.session = None

        self._update_token()

        self.session = self.oauth.get_session(self.token.access_token)

        self.last_request = time.time()
        self.request_period = request_period 
開發者ID:dkempiners,項目名稱:python-yahooapi,代碼行數:31,代碼來源:yahooapi.py

示例7: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def __init__(self, *vargs, **kwargs):
        options = dict(
            authorize_url='https://graph.facebook.com/oauth/authorize', 
            access_token_url='https://graph.facebook.com/oauth/access_token', 
            base_url='https://graph.facebook.com/', 
            )
        options.update(**kwargs)
        self.redirect_uri = options.get('redirect_uri')
        if 'redirect_uri' in options:
            del options['redirect_uri']
        super(OAuth2Service, self).__init__(*vargs, **options) 
開發者ID:debrouwere,項目名稱:facebook-insights,代碼行數:13,代碼來源:oauth.py

示例8: get_authorize_url

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def get_authorize_url(self, *vargs, **kwargs):
        options = dict(
            scope='manage_pages,read_insights',
            response_type='code',            
            redirect_uri=self.redirect_uri, 
            )
        options.update(**kwargs)
        return super(OAuth2Service, self).get_authorize_url(*vargs, **options) 
開發者ID:debrouwere,項目名稱:facebook-insights,代碼行數:10,代碼來源:oauth.py

示例9: authorize

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth2Service [as 別名]
def authorize(client_id, client_secret):
    facebook = OAuth2Service(
        client_id=client_id, 
        client_secret=client_secret,
        redirect_uri=REDIRECT_URI, 
        )
    user_token = authorize_user(facebook, long_term=True)
    page_tokens = authorize_pages(facebook, user_token)
    return page_tokens 
開發者ID:debrouwere,項目名稱:facebook-insights,代碼行數:11,代碼來源:oauth.py


注:本文中的rauth.OAuth2Service方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。