Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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
Python 2.7 云安全指挥中心API调用_Python 2.7_Google Cloud Platform - Fatal编程技术网

Python 2.7 云安全指挥中心API调用

Python 2.7 云安全指挥中心API调用,python-2.7,google-cloud-platform,Python 2.7,Google Cloud Platform,我正在使用list_findings()API列出云安全指挥中心中发现的安全问题。我想每5分钟列出一次调查结果 c = (datetime.utcnow() - timedelta(minutes =5)).replace(tzinfo=pytz.UTC, microsecond =0) project_filter = ( "state = \"ACTIVE\" AND create_time > \"2020-02-19T15:20:10-00:00\"" ) fin

我正在使用list_findings()API列出云安全指挥中心中发现的安全问题。我想每5分钟列出一次调查结果

 c = (datetime.utcnow() - timedelta(minutes =5)).replace(tzinfo=pytz.UTC, microsecond =0)
 project_filter = (
     "state = \"ACTIVE\" AND create_time > \"2020-02-19T15:20:10-00:00\""
 )
 finding_result_iterator = client.list_findings(source_name, filter_ = project_filter)
如何在项目过滤器中传递c的值?我不想硬编码创造时间的价值。在每次运行脚本时,它都会自动从变量c获得时间。我尝试了不同的方法来传递价值来创造时间,但它不起作用。有人能帮忙吗。这里是谷歌提供的文档链接

我试图使用类似的东西,但它给出了错误

project_filter = (
    "state = \"ACTIVE\" AND create_time >\'c\'"
)
错误-

google.api_core.exceptions.InvalidArgument: 400 Invalid Filter. Filter must be non-null and filter upon a field in the request. Example: "event_time = 123 OR event_time >= 123 OR event_time <= 123"

google.api_core.exceptions.InvalidArgument:400无效筛选器。筛选器必须为非null,并根据请求中的字段进行筛选。示例:“event_time=123或event_time>=123或event_time实际上project_filter是一个字符串,因此字符串连接起作用

project_filter = (
    "state = \"ACTIVE\" AND create_time > \"" + c + "\"" 
)