Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 在Python中对来自Google云日志的日志进行分页_Google Cloud Platform - Fatal编程技术网

Google cloud platform 在Python中对来自Google云日志的日志进行分页

Google cloud platform 在Python中对来自Google云日志的日志进行分页,google-cloud-platform,Google Cloud Platform,根据,对结果进行分页的正确方法是: pages = iterator.pages 然而,这是行不通的。我得到一个错误,说: 'generator' object has no attribute 'pages' 这确实有效: import google.cloud.logging client = google.cloud.logging.Client() iterator = client.list_entries(page_size=5) page1 = next(iterator)

根据,对结果进行分页的正确方法是:

pages = iterator.pages
然而,这是行不通的。我得到一个错误,说:

 'generator' object has no attribute 'pages'
这确实有效:

import google.cloud.logging
client = google.cloud.logging.Client()
iterator = client.list_entries(page_size=5)
page1 = next(iterator)
for entry in page1:
    print(entry)

但是,如何请求特定页面的结果?文档中说要使用“nextPageToken”作为参数来列出_条目,但我没有看到要使用的结果中存在任何pagetoken。

使用Google API,当您有一个长返回时,您就有分页。每个服务器响应都有一个next page令牌,用于请求获取此列表的以下结果


在这里,您希望立即转到定义的页码,例如,立即跳转到最后一页,或跳转到第5页。你不能,API不是这样设计的。

定义特定页面的含义。如果有另一页,则每页都包括
nextPageToken
。它不用作以下页面的索引。