我已經在 Django 中嘗試過 requests.post ,但它不起作用。request.get 很好。
headers = {'Content-type': 'application/json'}
answer = requests.post('http://www.testing/getdata', data = {'testing': 'testing'}, verify=False,auth=(testing,testing),headers=headers)
結果:
"Unexpected Error Occurred:RESTEASY008200: JSON Binding deserialization error"
uj5u.com熱心網友回復:
您發送了表單資料,但是您像發送 json 一樣設定了標題。
我猜你想做這樣的事情:
headers = {'Content-type': 'application/json'}
answer = requests.post('http://www.testing/getdata', json = {'testing': 'testing'}, verify=False,auth=(testing,testing),headers=headers)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/414644.html
標籤:
