本文整理匯總了Python中oauth2client._helpers.scopes_to_string方法的典型用法代碼示例。如果您正苦於以下問題:Python _helpers.scopes_to_string方法的具體用法?Python _helpers.scopes_to_string怎麽用?Python _helpers.scopes_to_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oauth2client._helpers
的用法示例。
在下文中一共展示了_helpers.scopes_to_string方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import scopes_to_string [as 別名]
def __init__(self, scope, **kwargs):
"""Constructor for AppAssertionCredentials
Args:
scope: string or iterable of strings, scope(s) of the credentials
being requested.
**kwargs: optional keyword args, including:
service_account_id: service account id of the application. If None
or unspecified, the default service account for
the app is used.
"""
self.scope = _helpers.scopes_to_string(scope)
self._kwargs = kwargs
self.service_account_id = kwargs.get('service_account_id', None)
self._service_account_email = None
# Assertion type is no longer used, but still in the
# parent class signature.
super(AppAssertionCredentials, self).__init__(None)
示例2: __init__
# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import scopes_to_string [as 別名]
def __init__(self,
service_account_email,
signer,
scopes='',
private_key_id=None,
client_id=None,
user_agent=None,
token_uri=oauth2client.GOOGLE_TOKEN_URI,
revoke_uri=oauth2client.GOOGLE_REVOKE_URI,
**kwargs):
super(ServiceAccountCredentials, self).__init__(
None, user_agent=user_agent, token_uri=token_uri,
revoke_uri=revoke_uri)
self._service_account_email = service_account_email
self._signer = signer
self._scopes = _helpers.scopes_to_string(scopes)
self._private_key_id = private_key_id
self.client_id = client_id
self._user_agent = user_agent
self._kwargs = kwargs
示例3: test_iterables
# 需要導入模塊: from oauth2client import _helpers [as 別名]
# 或者: from oauth2client._helpers import scopes_to_string [as 別名]
def test_iterables(self):
cases = [
('', ''),
('', ()),
('', []),
('', ('',)),
('', ['', ]),
('a', ('a',)),
('b', ['b', ]),
('a b', ['a', 'b']),
('a b', ('a', 'b')),
('a b', 'a b'),
('a b', (s for s in ['a', 'b'])),
]
for expected, case in cases:
self.assertEqual(expected, _helpers.scopes_to_string(case))