请选择 进入手机版 | 继续访问电脑版

[开发资源分享] 求助!!如何写python的接口

[复制链接]
一直报400/401/404的错,求助!!!





url = 'http://robot.open.xiaoi.com/ask.do'

data = {'question': 'hi', 'userId': '001', 'type': '1'}

content = {
    "Cache-Control": "no-cache",
    "Pragma": "no-cache",
    "Host": 'http://open.xiaoi.com',
    "Connection": "Keep-Alive",
    # 'contentType': 'application/json;charset=UTF-8',
    "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
    "X-Auth": 'XXXXXXXX'}


r = requests.post(url=url, data=data, headers=content)

print(r.status_code)
回复

使用道具 举报

1条回复
content = {
    "Cache-Control": "no-cache",
    "Pragma": "no-cache",
    "Host": 'http://open.xiaoi.com',
    "Connection": "Keep-Alive",
    # 'contentType': 'application/json;charset=UTF-8',
    "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
    "X-Auth": 'XXXXXXXX'}这些去哪里获取?
支持 | 反对 | 回复

使用道具 举报

开发者交流
今日发帖: 0

小i微信公众号:
搜索 “xiaoirobot"
或扫描下面的二维码: