当前位置: 首页>>代码示例>>Python>>正文


Python clientsecrets.TYPE_WEB属性代码示例

本文整理汇总了Python中oauth2client.clientsecrets.TYPE_WEB属性的典型用法代码示例。如果您正苦于以下问题:Python clientsecrets.TYPE_WEB属性的具体用法?Python clientsecrets.TYPE_WEB怎么用?Python clientsecrets.TYPE_WEB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在oauth2client.clientsecrets的用法示例。


在下文中一共展示了clientsecrets.TYPE_WEB属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _load_client_secrets

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def _load_client_secrets(filename):
    """Loads client secrets from the given filename.

    Args:
        filename: The name of the file containing the JSON secret key.

    Returns:
        A 2-tuple, the first item containing the client id, and the second
        item containing a client secret.
    """
    client_type, client_info = clientsecrets.loadfile(filename)

    if client_type != clientsecrets.TYPE_WEB:
        raise ValueError(
            'The flow specified in {} is not supported, only the WEB flow '
            'type  is supported.'.format(client_type))
    return client_info['client_id'], client_info['client_secret'] 
开发者ID:fniephaus,项目名称:alfred-gmail,代码行数:19,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def __init__(self, filename, scope, message=None, cache=None, **kwargs):
    """Constructor

    Args:
      filename: string, File name of client secrets.
      scope: string or iterable of strings, scope(s) of the credentials being
        requested.
      message: string, A friendly string to display to the user if the
        clientsecrets file is missing or invalid. The message may contain HTML
        and will be presented on the web interface for any method that uses the
        decorator.
      cache: An optional cache service client that implements get() and set()
        methods. See clientsecrets.loadfile() for details.
      **kwargs: dict, Keyword arguments are passed along as kwargs to
        the OAuth2WebServerFlow constructor.
    """
    client_type, client_info = clientsecrets.loadfile(filename, cache=cache)
    if client_type not in [
        clientsecrets.TYPE_WEB, clientsecrets.TYPE_INSTALLED]:
      raise InvalidClientSecretsError(
          "OAuth2Decorator doesn't support this OAuth 2.0 flow.")
    constructor_kwargs = dict(kwargs)
    constructor_kwargs.update({
        'auth_uri': client_info['auth_uri'],
        'token_uri': client_info['token_uri'],
        'message': message,
    })
    revoke_uri = client_info.get('revoke_uri')
    if revoke_uri is not None:
      constructor_kwargs['revoke_uri'] = revoke_uri
    super(OAuth2DecoratorFromClientSecrets, self).__init__(
        client_info['client_id'], client_info['client_secret'],
        scope, **constructor_kwargs)
    if message is not None:
      self._message = message
    else:
      self._message = 'Please configure your application for OAuth 2.0.' 
开发者ID:mortcanty,项目名称:earthengine,代码行数:39,代码来源:appengine.py

示例3: __init__

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def __init__(self, filename, scope, message=None, cache=None):
    """Constructor

    Args:
      filename: string, File name of client secrets.
      scope: string or iterable of strings, scope(s) of the credentials being
        requested.
      message: string, A friendly string to display to the user if the
        clientsecrets file is missing or invalid. The message may contain HTML
        and will be presented on the web interface for any method that uses the
        decorator.
      cache: An optional cache service client that implements get() and set()
        methods. See clientsecrets.loadfile() for details.
    """
    client_type, client_info = clientsecrets.loadfile(filename, cache=cache)
    if client_type not in [
        clientsecrets.TYPE_WEB, clientsecrets.TYPE_INSTALLED]:
      raise InvalidClientSecretsError(
          'OAuth2Decorator doesn\'t support this OAuth 2.0 flow.')
    constructor_kwargs = {
      'auth_uri': client_info['auth_uri'],
      'token_uri': client_info['token_uri'],
      'message': message,
    }
    revoke_uri = client_info.get('revoke_uri')
    if revoke_uri is not None:
      constructor_kwargs['revoke_uri'] = revoke_uri
    super(OAuth2DecoratorFromClientSecrets, self).__init__(
        client_info['client_id'], client_info['client_secret'],
        scope, **constructor_kwargs)
    if message is not None:
      self._message = message
    else:
      self._message = 'Please configure your application for OAuth 2.0.' 
开发者ID:splunk,项目名称:splunk-ref-pas-code,代码行数:36,代码来源:appengine.py

示例4: _load_client_secrets

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def _load_client_secrets(filename):
    """Loads client secrets from the given filename."""
    client_type, client_info = clientsecrets.loadfile(filename)

    if client_type != clientsecrets.TYPE_WEB:
        raise ValueError(
            'The flow specified in {} is not supported, only the WEB flow '
            'type  is supported.'.format(client_type))
    return client_info['client_id'], client_info['client_secret'] 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:11,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def __init__(self, filename, scope, message=None, cache=None, **kwargs):
        """Constructor

        Args:
            filename: string, File name of client secrets.
            scope: string or iterable of strings, scope(s) of the credentials
                   being requested.
            message: string, A friendly string to display to the user if the
                     clientsecrets file is missing or invalid. The message may
                     contain HTML and will be presented on the web interface
                     for any method that uses the decorator.
            cache: An optional cache service client that implements get() and
                   set()
            methods. See clientsecrets.loadfile() for details.
            **kwargs: dict, Keyword arguments are passed along as kwargs to
                      the OAuth2WebServerFlow constructor.
        """
        client_type, client_info = clientsecrets.loadfile(filename,
                                                          cache=cache)
        if client_type not in (clientsecrets.TYPE_WEB,
                               clientsecrets.TYPE_INSTALLED):
            raise InvalidClientSecretsError(
                "OAuth2Decorator doesn't support this OAuth 2.0 flow.")

        constructor_kwargs = dict(kwargs)
        constructor_kwargs.update({
            'auth_uri': client_info['auth_uri'],
            'token_uri': client_info['token_uri'],
            'message': message,
        })
        revoke_uri = client_info.get('revoke_uri')
        if revoke_uri is not None:
            constructor_kwargs['revoke_uri'] = revoke_uri
        super(OAuth2DecoratorFromClientSecrets, self).__init__(
            client_info['client_id'], client_info['client_secret'],
            scope, **constructor_kwargs)
        if message is not None:
            self._message = message
        else:
            self._message = 'Please configure your application for OAuth 2.0.' 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:42,代码来源:appengine.py

示例6: _load_client_secrets

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def _load_client_secrets(self, filename):
        """Loads client secrets from the given filename."""
        client_type, client_info = clientsecrets.loadfile(filename)
        if client_type != clientsecrets.TYPE_WEB:
            raise ValueError(
                'The flow specified in {0} is not supported.'.format(
                    client_type))

        self.client_id = client_info['client_id']
        self.client_secret = client_info['client_secret'] 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:12,代码来源:flask_util.py

示例7: __init__

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def __init__(self, filename, scope, message=None, cache=None, **kwargs):
        """Constructor

        Args:
            filename: string, File name of client secrets.
            scope: string or iterable of strings, scope(s) of the credentials
                   being requested.
            message: string, A friendly string to display to the user if the
                     clientsecrets file is missing or invalid. The message may
                     contain HTML and will be presented on the web interface
                     for any method that uses the decorator.
            cache: An optional cache service client that implements get() and
                   set()
            methods. See clientsecrets.loadfile() for details.
            **kwargs: dict, Keyword arguments are passed along as kwargs to
                      the OAuth2WebServerFlow constructor.
        """
        client_type, client_info = clientsecrets.loadfile(filename,
                                                          cache=cache)
        if client_type not in (clientsecrets.TYPE_WEB,
                               clientsecrets.TYPE_INSTALLED):
            raise clientsecrets.InvalidClientSecretsError(
                "OAuth2Decorator doesn't support this OAuth 2.0 flow.")

        constructor_kwargs = dict(kwargs)
        constructor_kwargs.update({
            'auth_uri': client_info['auth_uri'],
            'token_uri': client_info['token_uri'],
            'message': message,
        })
        revoke_uri = client_info.get('revoke_uri')
        if revoke_uri is not None:
            constructor_kwargs['revoke_uri'] = revoke_uri
        super(OAuth2DecoratorFromClientSecrets, self).__init__(
            client_info['client_id'], client_info['client_secret'],
            scope, **constructor_kwargs)
        if message is not None:
            self._message = message
        else:
            self._message = 'Please configure your application for OAuth 2.0.' 
开发者ID:fniephaus,项目名称:alfred-gmail,代码行数:42,代码来源:appengine.py

示例8: test_invalid_client_type

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def test_invalid_client_type(self):
        fake_type = 'fake_type'
        self.assertNotEqual(fake_type, clientsecrets.TYPE_WEB)
        self.assertNotEqual(fake_type, clientsecrets.TYPE_INSTALLED)
        with self.assertRaises(clientsecrets.InvalidClientSecretsError):
            clientsecrets._validate_clientsecrets({fake_type: None}) 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:8,代码来源:test_clientsecrets.py

示例9: test_missing_required_type_web

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def test_missing_required_type_web(self):
        required = clientsecrets.VALID_CLIENT[
            clientsecrets.TYPE_WEB]['required']
        # We will certainly have less than all 5 keys.
        self.assertEqual(len(required), 5)

        clientsecrets_dict = {
            clientsecrets.TYPE_WEB: {'not_required': None},
        }
        with self.assertRaises(clientsecrets.InvalidClientSecretsError):
            clientsecrets._validate_clientsecrets(clientsecrets_dict) 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:13,代码来源:test_clientsecrets.py

示例10: test_success_type_web

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def test_success_type_web(self):
        client_info = {
            'client_id': 'eye-dee',
            'client_secret': 'seekrit',
            'redirect_uris': None,
            'auth_uri': None,
            'token_uri': None,
        }
        clientsecrets_dict = {
            clientsecrets.TYPE_WEB: client_info,
        }
        result = clientsecrets._validate_clientsecrets(clientsecrets_dict)
        self.assertEqual(result, (clientsecrets.TYPE_WEB, client_info)) 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:15,代码来源:test_clientsecrets.py

示例11: test_success

# 需要导入模块: from oauth2client import clientsecrets [as 别名]
# 或者: from oauth2client.clientsecrets import TYPE_WEB [as 别名]
def test_success(self):
        client_type, client_info = clientsecrets._loadfile(VALID_FILE)
        expected_client_info = {
            'client_id': 'foo_client_id',
            'client_secret': 'foo_client_secret',
            'redirect_uris': [],
            'auth_uri': oauth2client.GOOGLE_AUTH_URI,
            'token_uri': oauth2client.GOOGLE_TOKEN_URI,
            'revoke_uri': oauth2client.GOOGLE_REVOKE_URI,
        }
        self.assertEqual(client_type, clientsecrets.TYPE_WEB)
        self.assertEqual(client_info, expected_client_info) 
开发者ID:haynieresearch,项目名称:jarvis,代码行数:14,代码来源:test_clientsecrets.py


注:本文中的oauth2client.clientsecrets.TYPE_WEB属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。