Well, that's what I'd do in bash Here's what I have so far:
import urllib2
from BeautifulSoup import BeautifulStoneSoup
xml = urllib2.urlopen('http://weatherlink.com/xml.php?user=blah&pass=blah')
soup = BeautifulStoneSoup(xml)
print soup.prettify()
but all it does is grab the html page, not the xml it should serve. The example xml looks like:
...
<title>blah</title>
<link>http://www.blah.com</link>
</image>
<suggested_pickup>15 minutes after the hour</suggested_pickup>
<dewpoint_c>16.7</dewpoint_c>
<dewpoint_f>62</dewpoint_f>
<heat_index_f>77</heat_index_f>
...
what can I do to make:
some_data {}
some_data [ 'dewpoint_c' ] = 16.7
some_data [ 'heat_index' ] = 77
or whatever those values should be from the xml it should get? I've also tried things like:
dom = minidom.parse(urllib2.urlopen(url))
&
xml = ElementTree.fromstring(result)
print xml.findtext(".//heat_index_f")
but don't seem to be getting anywhere.