I was looking to get weather data without using regex. Turns out it is pretty easy. This is an almost copy/paste replacement for the weather script I have seen other places. This is also a good example to get started with pulling other XML feeds.
import xml.dom.minidom
#get the data
response = system.net.httpGet("http://xml.weather.yahoo.com/forecastrss?p=55012")
#put it in the dom
dom1 = xml.dom.minidom.parseString(response)
#get the tag for current conditions
for node in dom1.getElementsByTagName("yweather:condition"):
#get the attributes, and write the tags
system.tag.writeToTag("Weather/Condition",node.getAttribute("text"))
system.tag.writeToTag("Weather/Code",node.getAttribute("code"))
system.tag.writeToTag("Weather/Temp",node.getAttribute("temp"))
#the first forecast in the file is for today (there are two in this feed)
day = "Today"
#loop through the forecasts
for node in dom1.getElementsByTagName("yweather:forecast"):
#get the attributes and write the appropriate tags
system.tag.writeToTag("Weather/"+day+"/date",node.getAttribute("date"))
system.tag.writeToTag("Weather/"+day+"/low",node.getAttribute("low"))
system.tag.writeToTag("Weather/"+day+"/high",node.getAttribute("high"))
system.tag.writeToTag("Weather/"+day+"/condition",node.getAttribute("text"))
#the second time we loop through, write the data to the tomorrow folder
day = "Tomorrow"
I sure like this too. have you guys come up with a better radar feed? im using accuweather thats an image from url.
I also noticed accuweather “sells” a tailored xml service for a monthly fee. would any of you care to post any screenhots
from your weather feed?
[quote=“tailfire”]I sure like this too. have you guys come up with a better radar feed? im using accuweather thats an image from url.
I also noticed accuweather “sells” a tailored xml service for a monthly fee. would any of you care to post any screenhots
from your weather feed?[/quote]
wow ! i searched for it and they (noaa) offer wsdl/xml services!!! very cool. doez not appear that the example in this post
is using it. can you post examples if you are using the noaa service?
The xml feed in this post appears way easier to use than the wsdl from noaa
Is there a chance that the IA guys can post some examples/how-to’s on actually implementing the suds for wsdl services. I have a lighting controls server getting ready to arrive at my plant for the cutler hammer lighting controls that I am adding to our scada.
I purchased this thing in hopes of working through the details. It looks to me like practicing with the noaa service might be good wsdl practice.
Any help and or documentation here by the IA guys would be appreciated…