FAQ
Hi all,
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.

--
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap

Search Discussions

  • Stefan Behnel at Jan 27, 2011 at 5:39 am

    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()).

    Stefan
  • Alex Hall at Jan 27, 2011 at 1:39 pm

    On 1/27/11, Stefan Behnel 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedJan 27, '11 at 4:01a
activeJan 27, '11 at 1:39p
posts3
users2
websitepython.org

2 users in discussion

Alex Hall: 2 posts Stefan Behnel: 1 post

People

Translate

site design / logo © 2022 Grokbase