GET在python中返回400

时间:2018-06-11 08:07:06

标签: python-3.x python-requests

req_url = 'http://www.example.com/' 

request = {
    "view":"ecpcisqeddscat:_deals_tearsheet_bic",
    "address":"10.51.0.104:9090",
    "metadatastore":"",
    "keytype":"key",
    "rowkeys":str(["154083204960","154083277473"]),
    "simplifyresult":str(False),
    "haslQuery":""
}

headers = {
    "Host": "nycssnsqa3.amers.ime.reuters.com",
    "Accept": "* / *",
    "Content - Type": "application / json",
    "User - Agent": "Mozilla / 5.0(Windows NT 6.1; Win64;x64) AppleWebKit "
    "/ 537.36(KHTML, like Gecko) Chrome / 67.0.3396.79  Safari / 537.36"
}

headers.update(request)
session = requests.Session()
session.headers = headers
r = session.get(req_url)

print(r.url)
print(r)

if r.status_code == 200:
    return r.json()

输出

<Response [400]>
None

我认为请求部分存在一些问题,但我无法弄清楚它是什么。在网站中,它已作为GET请求中的标头参数传递。

0 个答案:

没有答案