开发给的接口是这样的,有 headers 的数据,用 python 不知道为啥一直报错,用 postman 可以正常调用
请问传入 headers 怎么传入?
import requests
import json
import urllib
import urllib2
url = "http://ivt3.hschefu.com:9199/login"
# headers = {'content-type': 'application/json'}
data1 = {'password': '12345678','username': 'xiangjin'}
para = json.dumps(data1)
print(para)
header1 ={'app': 'string','gps': 'string','os': 'string','token': 'string','ver': 'string'}
# print(header1)
# header2 = json.dumps(header1)
# print(header2)
# headers = {}
# headers= json.dumps(headers)
r = requests.post(url,data=para,headers= header1)
print(r.text)