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


Python rauth.OAuth1Service方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth1Service [as 別名]
def __init__(self, app_key, app_secret, user_social_auth):
        """Constructor for YahooOAuthClient

        `app_key` - Yahoo App Key
        `app_secret` - Yahoo App Secret
        `user_social_auth` - UserSocialAuth model to store refreshed token
        """
        # UserSocialAuth needed to access the access token
        self.last_error = None
        self.user_social_auth = user_social_auth
        self.access_token = user_social_auth.extra_data.get('access_token')
        self.oauth = OAuth1Service(
                name='Yahoo',
                consumer_key=app_key,
                consumer_secret=app_secret,
                request_token_url=YAHOO_OAUTH_REQUEST_TOKEN_URL,
                access_token_url=YAHOO_OAUTH_ACCESS_TOKEN_URL,
                authorize_url=YAHOO_OAUTH_AUTHORIZE_URL,
            )
        self.session = self.oauth.get_session((self.access_token['oauth_token'], self.access_token['oauth_token_secret'])) 
開發者ID:hacktoolkit,項目名稱:django-htk,代碼行數:22,代碼來源:oauth.py

示例2: __osm_auth_service

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth1Service [as 別名]
def __osm_auth_service() -> OAuth1Service:
    """Factory method that builds osm auth service"""
    osm = OAuth1Service(
        name='openstreetmap',
        consumer_key='rBWV8Eaottv44tXfdLofdNvVemHOL62Lsutpb9tw',
        consumer_secret='rpmeZIp49sEjjcz91X9dsY0vD1PpEduixuPy8T6S',
        request_token_url='https://www.openstreetmap.org/oauth/request_token',
        access_token_url='https://www.openstreetmap.org/oauth/access_token',
        authorize_url='https://www.openstreetmap.org/oauth/authorize',
        signature_obj='',
        base_url='https://www.openstreetmap.org/')
    return osm 
開發者ID:openstreetcam,項目名稱:upload-scripts,代碼行數:14,代碼來源:osm_access.py

示例3: __init__

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth1Service [as 別名]
def __init__(self):
        super(TwitterSignIn, self).__init__('twitter')
        self.service = OAuth1Service(
            name='twitter',
            consumer_key=self.consumer_id,
            consumer_secret=self.consumer_secret,
            request_token_url='https://api.twitter.com/oauth/request_token',
            authorize_url='https://api.twitter.com/oauth/authorize',
            access_token_url='https://api.twitter.com/oauth/access_token',
            base_url='https://api.twitter.com/1.1/'
        ) 
開發者ID:miguelgrinberg,項目名稱:flask-oauth-example,代碼行數:13,代碼來源:oauth.py

示例4: create_api_key

# 需要導入模塊: import rauth [as 別名]
# 或者: from rauth import OAuth1Service [as 別名]
def create_api_key():
        """ Interactively create a new API key via Zotero's OAuth API.

        Requires the user to enter a verification key displayed in the browser.

        :returns:   API key and the user's library ID
        """
        auth = OAuth1Service(
            name='zotero',
            consumer_key=CLIENT_KEY,
            consumer_secret=CLIENT_SECRET,
            request_token_url=REQUEST_TOKEN_URL,
            access_token_url=ACCESS_TOKEN_URL,
            authorize_url=AUTH_URL,
            base_url=BASE_URL)
        token, secret = auth.get_request_token(
            params={'oauth_callback': 'oob'})
        auth_url = auth.get_authorize_url(token)
        auth_url += '&' + urlencode({
            'name': 'zotero-cli',
            'library_access': 1,
            'notes_access': 1,
            'write_access': 1,
            'all_groups': 'read'})
        click.echo("Opening {} in browser, please confirm.".format(auth_url))
        click.launch(auth_url)
        verification = click.prompt("Enter verification code")
        token_resp = auth.get_raw_access_token(
            token, secret, method='POST',
            data={'oauth_verifier': verification})
        if not token_resp:
            logging.debug(token_resp.content)
            click.fail("Error during API key generation.")
        access = urlparse.parse_qs(token_resp.text)
        return access['oauth_token'][0], access['userID'][0] 
開發者ID:jbaiter,項目名稱:zotero-cli,代碼行數:37,代碼來源:backend.py


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