[Tutor] get xml for parsing?
Alex Hall
mehgcap at gmail.com
Thu Jan 27 14:39:17 CET 2011
On 1/27/11, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Alex Hall, 27.01.2011 05:01:
>> How would I go about getting the xml from a website through the site's
>> api? The url does not end in .xml since the xml is generated based on
>> the parameters in the url. For example:
>> https://api.website.com/user/me/count/10?api_key=MY_KEY
>> would return ten results (the count parameter) as xml. How do I
>> actually get this xml into my program? TIA.
>
> The filename extension doesn't matter. If you know it's XML that you get
> back, you can use ElementTree (in the xml.etree package) or lxml (external
> package) to read it. Use the urllib2 package in the standard library to
> request the XML page, then pass the result into the XML parser (parse()).
Okay, thanks!
>
> Stefan
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap
More information about the Tutor
mailing list