尝试在 DigitalOcean 上创建新的 PaaS 应用程序时出错。已经看过文档并且无法弄清楚为什么这不起作用。该spec
对象基本上取自文档。
import requests
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer MY_TOKEN'
}
spec = {
"name": "test-app",
"region": "nyc1",
"services": [
{
"name": "api",
"github": {
"branch": "main",
"deploy_on_push": 'true',
"repo": "username/my-app"
},
"run_command": "python3 application.py",
"environment_slug": "python",
"instance_count": 2,
"instance_size_slug": "basic-xxs",
"routes": [
{
"path": "/api"
}
]
}
]
}
payload = {'spec': spec}
res = requests.post(
'https://api.digitalocean.com/v2/apps',
headers=headers,
data=payload,
)
print(res)
print(res.json())
print(res.status_code)
我收到以下错误。这是我发送数据方式的错误吗?
<Response [400]>
{'id': 'invalid_argument', 'message': "invalid character 's' looking for beginning of value"}