wordpress - Heroku 应用程序:来自 Heroku 应用程序的 REST API POST 请求返回错误 503,但它在本地工作
问题描述
user = '##'
pythonapp = '###' #i have entered credentials here
url = 'https://##.com/wp-json/wp/v2'
credentials = user + ':' + pythonapp
token = base64.b64encode(credentials.encode())
headers = {'Authorization': 'Basic ' + token.decode('utf-8')}
post = { 'title': title,'status': 'publish','content': w,'format': 'standard'}
r = requests.post(url + '/posts', headers=headers, json=post)
return render_template('shortenurl.html', short1=aa,short=r)
它在本地运行烧瓶应用程序时工作正常。但是在 Heroku 应用程序上部署时显示 503 错误
注意:这是用于使用 python 和 REST API 在 wordpress 上创建帖子。
解决方案
推荐阅读
- c++ - 什么时候使用作用域指针有用,什么时候被销毁?
- amazon-web-services - 在 Pyspark 中使用模式加载数据时为 NULL
- android - WebSetting allowFileAccessFromFileURLs 在 API 级别 30 中已弃用
- visual-studio - 安装 Microsoft.PowerShell.SDK 后,我的项目中添加了一个“运行时”文件夹
- bash - 是否可以在 trap 命令中使用 Bash 历史扩展?
- python - Django - 对包含 recaptcha 的表单进行单元测试
- azure - 在 Azure 容器实例 (ACI) 中运行 Gitlab Runner
- java - Android工作室,回收视图
- python - 与 tensorflow 2 的深度互相关
- python - 用于使用 LSTM 进行情感分析的多类分类的 Keras 模型 - 如何改进我的模型?