xml-parsing

Python - How to parse xml response and store a elements value in a variable?

我只是一个虾纸丫 提交于 2020-08-26 09:28:33
问题 enter code here I am getting the XML response from the API call. I need the "testId" attribute value from this response, Please help me on this. r=requests.get( myconfig.URL_webpagetest + "?url=" + testurl + "&f=xml&k=" + myconfig.apikey_webpagetest ) xmltxt=r.content print (xmltxt) testId = XML (xmltxt).find("testId").text r=requests.get("http://www.webpagetest.org/testStatus.php?f=xml&test=" + testId ) xml response - <?xml version="1.0" encoding="UTF-8"?> <response> <statusCode>200<

Python - How to parse xml response and store a elements value in a variable?

ぐ巨炮叔叔 提交于 2020-08-26 09:28:08
问题 enter code here I am getting the XML response from the API call. I need the "testId" attribute value from this response, Please help me on this. r=requests.get( myconfig.URL_webpagetest + "?url=" + testurl + "&f=xml&k=" + myconfig.apikey_webpagetest ) xmltxt=r.content print (xmltxt) testId = XML (xmltxt).find("testId").text r=requests.get("http://www.webpagetest.org/testStatus.php?f=xml&test=" + testId ) xml response - <?xml version="1.0" encoding="UTF-8"?> <response> <statusCode>200<