當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。