Skip to content Skip to sidebar Skip to footer

How Can I Get Xml Attributes And Values From An Rss Feed In Python?

I'm using the Yahoo! Weather API to retrieve some values. This is the request: Los Angeles Weather How can I get attributes and values from the following:

Solution 1:

You can do this using the feedparser library:

import feedparser

feed = feedparser.parse('http://weather.yahooapis.com/forecastrss?w=2442047&u=c')
print 'Sunrise:', feed.feed.yweather_astronomy['sunrise']
print 'Sunset:', feed.feed.yweather_astronomy['sunset']

Post a Comment for "How Can I Get Xml Attributes And Values From An Rss Feed In Python?"