擅长:python、mysql、java
<p><code>xmltodict</code>使用<code>urllib3</code></p>
<pre><code>import traceback
import urllib3
import xmltodict
def getxml()
url = "https://yoursite/your.xml"
import urllib3
import xmltodict
http = urllib3.PoolManager()
response = http.request('GET', url)
try:
data = xmltodict.parse(response.data)
except:
print("Failed to parse xml from response (%s)" % traceback.format_exc())
return data
</code></pre>