使用 http.client 从 Qualtrics 导出调查回复。为了获得我的调查回复,我需要进度 ID ...当我创建数据导出时,我能够看到它的结果,但在尝试获取我需要的值时出现 NoneType 错误:
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"}}
所以我清楚地看到了我需要的 progressId 值,但是当我试图抓住它时......
progressId = downloadRequestResponse.json()["result"]["progressId"]
AttributeError: 'NoneType' object has no attribute 'json'
(我知道我可以使用 Qualtrics 建议的请求库,但出于我的目的,我需要使用 http.client 或 urllib)