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


Python oauth2client.Credentials方法代码示例

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


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

示例1: locked_put

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_put(self, credentials, overwrite=False):
    """Write a Credentials to the datastore.

    Args:
      credentials: Credentials, the credentials to store.
      overwrite: Boolean, indicates whether you would like these credentials to
                          overwrite any existing stored credentials.
    """
    args = {self.key_name: self.key_value}

    if overwrite:
      entity, unused_is_new = self.model_class.objects.get_or_create(**args)
    else:
      entity = self.model_class(**args)

    setattr(entity, self.property_name, credentials)
    entity.save() 
开发者ID:mortcanty,项目名称:earthengine,代码行数:19,代码来源:django_orm.py

示例2: locked_put

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_put(self, credentials, overwrite=False):
        """Write a Credentials to the Django datastore.

        Args:
            credentials: Credentials, the credentials to store.
            overwrite: Boolean, indicates whether you would like these
                       credentials to overwrite any existing stored
                       credentials.
        """
        args = {self.key_name: self.key_value}

        if overwrite:
            (entity,
             unused_is_new) = self.model_class.objects.get_or_create(**args)
        else:
            entity = self.model_class(**args)

        setattr(entity, self.property_name, credentials)
        entity.save() 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:21,代码来源:django_orm.py

示例3: locked_get

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_get(self):
        """Retrieve Credential from datastore.

        Returns:
            oauth2client.Credentials
        """
        credentials = None
        if self._cache:
            json = self._cache.get(self._key_name)
            if json:
                credentials = client.Credentials.new_from_json(json)
        if credentials is None:
            entity = self._get_entity()
            if entity is not None:
                credentials = getattr(entity, self._property_name)
                if self._cache:
                    self._cache.set(self._key_name, credentials.to_json())

        if credentials and hasattr(credentials, 'set_store'):
            credentials.set_store(self)
        return credentials 
开发者ID:fniephaus,项目名称:alfred-gmail,代码行数:23,代码来源:appengine.py

示例4: to_python

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def to_python(self, value):
    if value is None:
      return None
    if isinstance(value, oauth2client.client.Credentials):
      return value
    return pickle.loads(base64.b64decode(value)) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:8,代码来源:django_orm.py

示例5: locked_get

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_get(self):
    """Retrieve Credential from datastore.

    Returns:
      oauth2client.Credentials
    """
    credential = None

    query = {self.key_name: self.key_value}
    entities = self.model_class.objects.filter(**query)
    if len(entities) > 0:
      credential = getattr(entities[0], self.property_name)
      if credential and hasattr(credential, 'set_store'):
        credential.set_store(self)
    return credential 
开发者ID:mortcanty,项目名称:earthengine,代码行数:17,代码来源:django_orm.py

示例6: locked_delete

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_delete(self):
    """Delete Credentials from the datastore."""

    query = {self.key_name: self.key_value}
    entities = self.model_class.objects.filter(**query).delete() 
开发者ID:mortcanty,项目名称:earthengine,代码行数:7,代码来源:django_orm.py

示例7: locked_put

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_put(self, credentials):
    """Write a Credentials to the datastore.

    Args:
      credentials: Credentials, the credentials to store.
    """
    args = {self.key_name: self.key_value}
    entity = self.model_class(**args)
    setattr(entity, self.property_name, credentials)
    entity.save() 
开发者ID:splunk,项目名称:splunk-ref-pas-code,代码行数:12,代码来源:django_orm.py

示例8: to_python

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def to_python(self, value):
        if value is None:
            return None
        if isinstance(value, oauth2client.client.Credentials):
            return value
        return pickle.loads(base64.b64decode(smart_bytes(value))) 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:8,代码来源:django_orm.py

示例9: locked_get

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_get(self):
        """Retrieve stored credential.

        Returns:
            oauth2client.Credentials
        """
        credential = None

        query = {self.key_name: self.key_value}
        entities = self.model_class.objects.filter(**query)
        if len(entities) > 0:
            credential = getattr(entities[0], self.property_name)
            if credential and hasattr(credential, 'set_store'):
                credential.set_store(self)
        return credential 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:17,代码来源:django_orm.py

示例10: locked_delete

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def locked_delete(self):
        """Delete Credentials from the datastore."""

        query = {self.key_name: self.key_value}
        entities = self.model_class.objects.filter(**query).delete() 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:7,代码来源:django_orm.py

示例11: make_value_from_datastore

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def make_value_from_datastore(self, value):
        logger.info("make: Got type " + str(type(value)))
        if value is None:
            return None
        if len(value) == 0:
            return None
        try:
            credentials = client.Credentials.new_from_json(value)
        except ValueError:
            credentials = None
        return credentials 
开发者ID:fniephaus,项目名称:alfred-gmail,代码行数:13,代码来源:appengine.py

示例12: validate

# 需要导入模块: import oauth2client [as 别名]
# 或者: from oauth2client import Credentials [as 别名]
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, client.Credentials):
            raise db.BadValueError(
                'Property {0} must be convertible '
                'to a Credentials instance ({1})'.format(self.name, value))
        return value 
开发者ID:fniephaus,项目名称:alfred-gmail,代码行数:10,代码来源:appengine.py


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