我是python新手,我正在尝试用JSON发布到https API,我使用的是ironpython2.7和请求,python2.7 这是我的密码
import requests
import json
def PostData(uri, Timestamp, ProxyIP, ProxyPort, username, password, UserAgent, Joson):
payload = {"Timestamp": Timestamp}
headers = {"user-agent": UserAgent,
"ContentType" :"application/json"}
r = requests.post(uri,params=payload,json=json.dumps(Joson))
return r.text
但我总是犯错误:
IronPython Requests Error: expected <type 'bytes'>
即使我只是使用
requests.post(uri)
如何解决这个问题?谢谢你的帮助
是否尝试将
bytes
作为uri传递:相关问题 更多 >
编程相关推荐