【发布时间】:2016-07-28 17:40:51
【问题描述】:
我正在使用 App Engine,我正在尝试将数据发布到与此类似的 URL:
https://push.geckoboard.com/v1/send/<widget-id>
我试过以下代码:
data = {
"api_key" : api_key,
"data" : {
"item" : [
{
"value" : chatamount
}
]
}
}
encoded_args = urllib.urlencode(data)
conn = httplib.HTTPSConnection(pushurl)
conn.request("POST", "", encoded_args)
response = conn.getresponse()
logging.info(response.status)
conn.close()
但是,日志记录返回 400 错误。有谁知道如何使用 Python 和 App Engine 执行简单的数据 POST?
【问题讨论】:
-
实际响应说什么?它应该提供有关问题所在的更多信息
-
我通常使用
urlfetch服务...例如stackoverflow.com/questions/28536376/… -
@ Suever 4,当我记录 response.reason 时,它说:400: Bad Request
-
@mgilson 谢谢,我会调查的!
标签: python http google-app-engine http-post