using http.client to export survey responses from Qualtrics. In order to get my survey responses I required the progress Id... when I create the data export I am able to see the result of it but get NoneType error when trying to get the value I need:
import http.client
baseUrl = "https://{0}.qualtrics.com/API/v3/surveys/{1}/export-responses/".format(dataCenter, surveyId)
headers = {
"content-type": "application/json",
"x-api-token": apiToken
}
downloadRequestPayload = '{"format":"' + fileFormat + '","useLabels":true}'
downloadRequestResponse = conn.request("POST", baseUrl, downloadRequestPayload, headers)
downloadRequestResponse
{"result":{"progressId":"ES_XXXXXzFLEPYYYYY","percentComplete":0.0,"status":"inProgress"},"meta":{"requestId":"13958595-XXXX-YYYY-ZZZZ-407d23462XXX","httpStatus":"200 - OK"}}
So I clearly see the progressId value I need but when I try to grab it...
progressId = downloadRequestResponse.json()["result"]["progressId"]
AttributeError: 'NoneType' object has no attribute 'json'
(I know I can use the requests library Qualtrics suggests but for my purpose I need to use http.client or urllib)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…