问题描述
我正在尝试使用 Python 客户端 google-cloud-tasks==2.1.0
使用 Google Cloud Tasks 创建任务,但我收到一个异常,要求 HttpRequest.url 是必需的。我正在设置相对 url,它是处理我的应用程序中任务的 URL。
队列存在并已使用以下方法创建:
gcloud task create queue notifications
代码:
client = tasks_v2.CloudTasksClient()
parent = client.queue_path(project,location,queue)
task = {
'app_engine_http_request': {
'http_method': tasks_v2.HttpMethod.POST,'relative_uri': notification_url,'body': payload.encode('utf-8')
},'http_request': {
'headers': {"Content-type": "application/json"}
}
}
response = client.create_task(parent=parent,task=task)
我收到的确切错误是:
google.api_core.exceptions.InvalidArgument: 400 HttpRequest.url is required
我正在尝试在我的 App Engine 标准环境中创建任务。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)