lundi 18 juillet 2016

get data from URL XML with python and xmltodict

I'm trying in python2.7 with xmltodict ext. get data from app engine API (XML type). Got no idea of how doing that... I tried to do so with local XML (I download it from source url) with success my local code look like this:

import xmltodict

document = open("my local pathAPI_GETDATA.xml", "r")

read_doc = document.read()

xml_doc = xmltodict.parse(read_doc)

for i in xml_doc:

    print (xml_doc[i])

    i=i+1

and my result is printing all XML fields.

How can I make it work on url? Is there any other thing I miss?

Aucun commentaire:

Enregistrer un commentaire