我已经浏览了Google 网站上的所有先决条件。
在服务器上获取并安装了 SSL 证书(来自 Let's Encrypt)。
在 Google Search Console(如https://example.org )上注册并验证了域(是的,https url )。
将域添加到我的 API 凭据的域验证中。
主题='项目/我的项目/订阅/我的主题'
sub='项目/myproject/subscription/mysub'
client.projects().topics().create(topic=topic, body={}).execute()
client.projects().subscriptions().create(name=sub, body={'topic': topic, 'pushConfig': {'pushEndpoint': ' https://example.org/push-handler '}})
我回来了:
googleapiclient.errors.HttpError:https://pubsub.googleapis.com/v1/projects/myproject/subscriptions/mysub?alt=json 返回“给定的推送端点无效(端点= https://example.org/push-handler) . 有关详细信息,请参阅https://cloud.google.com/pubsub/subscriber#create。">
此外,我无法从 Google 的 Pub/Sub 开发者控制台创建订阅。当我尝试时,我收到“无法添加订阅”通知。我是这个主题和项目的完全所有者,具有读写权限。我可以毫无问题地添加拉订阅。
关于为什么的任何想法?好像我不是唯一一个打这个的。