本文整理汇总了Python中oauthlib.oauth1.SIGNATURE_HMAC属性的典型用法代码示例。如果您正苦于以下问题:Python oauth1.SIGNATURE_HMAC属性的具体用法?Python oauth1.SIGNATURE_HMAC怎么用?Python oauth1.SIGNATURE_HMAC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类oauthlib.oauth1
的用法示例。
在下文中一共展示了oauth1.SIGNATURE_HMAC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from oauthlib import oauth1 [as 别名]
# 或者: from oauthlib.oauth1 import SIGNATURE_HMAC [as 别名]
def __init__(self, client_key,
client_secret=None,
resource_owner_key=None,
resource_owner_secret=None,
callback_uri=None,
signature_method=SIGNATURE_HMAC,
signature_type=SIGNATURE_TYPE_AUTH_HEADER,
rsa_key=None, verifier=None,
decoding='utf-8',
client_class=None,
force_include_body=False,
**kwargs):
try:
signature_type = signature_type.upper()
except AttributeError:
pass
client_class = client_class or self.client_class
self.force_include_body = force_include_body
self.client = client_class(client_key, client_secret, resource_owner_key,
resource_owner_secret, callback_uri, signature_method,
signature_type, rsa_key, verifier, decoding=decoding, **kwargs)
示例2: unauthorized_token_request
# 需要导入模块: from oauthlib import oauth1 [as 别名]
# 或者: from oauthlib.oauth1 import SIGNATURE_HMAC [as 别名]
def unauthorized_token_request(self):
"""Return request for unauthorized token (first stage)"""
params = self.request_token_extra_arguments()
params.update(self.get_scope_argument())
key, secret = self.get_key_and_secret()
# decoding='utf-8' produces errors with python-requests on Python3
# since the final URL will be of type bytes
decoding = None if six.PY3 else 'utf-8'
state = self.get_or_create_state()
auth = OAuth1(
key,
secret,
callback_uri=self.get_redirect_uri(state),
decoding=decoding,
signature_method=SIGNATURE_HMAC,
signature_type=SIGNATURE_TYPE_QUERY
)
url = self.REQUEST_TOKEN_URL + '?' + urlencode(params)
url, _, _ = auth.client.sign(url)
return url
示例3: oauth_auth
# 需要导入模块: from oauthlib import oauth1 [as 别名]
# 或者: from oauthlib.oauth1 import SIGNATURE_HMAC [as 别名]
def oauth_auth(self, token=None, oauth_verifier=None):
key, secret = self.get_key_and_secret()
oauth_verifier = oauth_verifier or self.data.get('oauth_verifier')
token = token or {}
# decoding='utf-8' produces errors with python-requests on Python3
# since the final URL will be of type bytes
decoding = None if six.PY3 else 'utf-8'
state = self.get_or_create_state()
return OAuth1(key, secret,
resource_owner_key=token.get('oauth_token'),
resource_owner_secret=token.get('oauth_token_secret'),
callback_uri=self.get_redirect_uri(state),
verifier=oauth_verifier,
signature_method=SIGNATURE_HMAC,
signature_type=SIGNATURE_TYPE_QUERY,
decoding=decoding)
示例4: allowed_signature_methods
# 需要导入模块: from oauthlib import oauth1 [as 别名]
# 或者: from oauthlib.oauth1 import SIGNATURE_HMAC [as 别名]
def allowed_signature_methods(self):
"""Allowed signature methods.
Default value: SIGNATURE_HMAC and SIGNATURE_RSA.
You can customize with Flask Config:
- OAUTH1_PROVIDER_SIGNATURE_METHODS
"""
return self._config.get(
'OAUTH1_PROVIDER_SIGNATURE_METHODS',
SIGNATURE_METHODS,
)