我已经通过了谷歌网站上的所有先决条件。
>
在服务器上获取并安装了SSL证书(来自Let's Encrypt)。
在Google搜索控制台(如https://example.org).
已添加到我的API凭据的域验证的域中。
topic='projects/myproject/subscriptions/mytic'
sub='pro je cs/我的项目/订阅/我的子'
client.projects().topics().create(topic=topic,body={}).execute()
client.projects()。订阅()。create(name=sub,body={'topic': topic,' push config ':{ ' push endpoint ':' https://example . org/push-handler ' } })
我回来了:
googleapiclient.errors.HttpError:https://pubsub.googleapis.com/v1/projects/myproject/subscriptions/mysub?alt=json 返回“给定的无效推送endpoint(endpoint=https://example.org/push-handler)。有关详细信息,请参阅 https://cloud.google.com/pubsub/subscriber#create。
此外,我无法从Google的Pub/Sub开发人员控制台创建订阅。当我尝试时,我收到了“无法添加订阅”通知。我是此主题和项目的完全所有者,具有读写权限。我可以毫无问题地添加拉取订阅。
知道为什么吗?看起来我不是唯一一个喜欢这个的人。
想通了。我包括了协议(https://example.org)在域验证中,而不仅仅是example.org。如果域验证工具能够提供一些验证来防止这种情况,那就太好了。
https://console.developers.google.com/apis/credentials/domainverification