2
我想發佈HTTP
請求。我設法讓代碼工作,但我掙扎着返回一些結果。響應'對象不可以訂閱Python http post請求
結果看起來是這樣的
{
"requestId" : "8317cgs1e1-36hd42-43h6be-br34r2-c70a6ege3fs5sbh",
"numberOfRequests" : 1893
}
我想獲得的RequestID,但我不斷收到錯誤響應」對象未標化的
import json
import requests
workingFile = 'D:\\test.json'
with open(workingFile, 'r') as fh:
data = json.load(fh)
url = 'http://jsontest'
username = 'user'
password = 'password123'
requestpost = requests.post(url, json=data, auth=(username, password))
print(requestpost["requestId"])