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


Python Bucket.reload方法代码示例

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


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

示例1: get_bucket

# 需要导入模块: from gcloud.storage.bucket import Bucket [as 别名]
# 或者: from gcloud.storage.bucket.Bucket import reload [as 别名]
def get_bucket(bucket_name, connection=None):
    """Get a bucket by name.

    If the bucket isn't found, this will raise a
    :class:`gcloud.storage.exceptions.NotFound`.

    For example::

      >>> from gcloud import storage
      >>> from gcloud.exceptions import NotFound
      >>> try:
      >>>   bucket = storage.get_bucket('my-bucket')
      >>> except NotFound:
      >>>   print 'Sorry, that bucket does not exist!'

    This implements "storage.buckets.get".

    :type bucket_name: string
    :param bucket_name: The name of the bucket to get.

    :type connection: :class:`gcloud.storage.connection.Connection` or
                      ``NoneType``
    :param connection: Optional. The connection to use when sending requests.
                       If not provided, falls back to default.

    :rtype: :class:`gcloud.storage.bucket.Bucket`
    :returns: The bucket matching the name provided.
    :raises: :class:`gcloud.exceptions.NotFound`
    """
    connection = _require_connection(connection)
    bucket = Bucket(bucket_name, connection=connection)
    bucket.reload()
    return bucket
开发者ID:Botanium,项目名称:gcloud-python,代码行数:35,代码来源:api.py

示例2: get_bucket

# 需要导入模块: from gcloud.storage.bucket import Bucket [as 别名]
# 或者: from gcloud.storage.bucket.Bucket import reload [as 别名]
    def get_bucket(self, bucket_name):
        """Get a bucket by name.

        If the bucket isn't found, this will raise a
        :class:`gcloud.storage.exceptions.NotFound`.

        For example::

          >>> try:
          >>>   bucket = client.get_bucket('my-bucket')
          >>> except gcloud.exceptions.NotFound:
          >>>   print 'Sorry, that bucket does not exist!'

        This implements "storage.buckets.get".

        :type bucket_name: string
        :param bucket_name: The name of the bucket to get.

        :rtype: :class:`gcloud.storage.bucket.Bucket`
        :returns: The bucket matching the name provided.
        :raises: :class:`gcloud.exceptions.NotFound`
        """
        bucket = Bucket(self, name=bucket_name)
        bucket.reload(client=self)
        return bucket
开发者ID:kgruen01,项目名称:CSSI,代码行数:27,代码来源:client.py


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