Author: duncan Date: Mon Sep 10 16:14:20 2007 New Revision: 9865 Log: Added some weather tests for the yahoo weather service and National Oceanic and Atmospheric Administration's National Weather Service Yahoo is a simple rss feed and the ndfd is a soap feed
Added: branches/rel-1/testing/Duncan/ branches/rel-1/testing/Duncan/weather/ branches/rel-1/testing/Duncan/weather/ndfd/ (props changed) branches/rel-1/testing/Duncan/weather/ndfd/DWML.xsd branches/rel-1/testing/Duncan/weather/ndfd/ndclient.py (contents, props changed) branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML.wsdl branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_client.py branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_server.py branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_types.py branches/rel-1/testing/Duncan/weather/yahoo/ branches/rel-1/testing/Duncan/weather/yahoo/yahoo.py (contents, props changed) branches/rel-1/testing/Duncan/weather/yahoo/yahoo.xml Added: branches/rel-1/testing/Duncan/weather/ndfd/DWML.xsd ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/DWML.xsd Mon Sep 10 16:14:20 2007 @@ -0,0 +1,44 @@ +<?xml version="1.0"?> + +<!-- ********************************************************************** + + DWML.xsd - Top level XML Schema for Digital Weather Markup Language + + John L. Schattel MDL 4 August 2004 + Red Hat Linux Apache Server + + ************************************************************************* --> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:include schemaLocation="http://www.weather.gov/forecasts/xml/DWMLgen/schema/meta_data.xsd" /> + <xsd:include schemaLocation="http://www.weather.gov/forecasts/xml/DWMLgen/schema/ndfd_data.xsd" /> + + <xsd:element name="dwml"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="head" type="headType" minOccurs="1" maxOccurs="1" /> + <xsd:element name="data" type="dataType" minOccurs="1" maxOccurs="1"> + <xsd:keyref name="applicable-locationKey" refer="locationKey"> + <xsd:selector xpath="data/parameters" /> + <xsd:field xpath="@applicable-location" /> + </xsd:keyref> + <xsd:key name="locationKey"> + <xsd:selector xpath=".//location" /> + <xsd:field xpath="location-key" /> + </xsd:key> + <xsd:keyref name="applicable-timeKey" refer="timeKey"> + <xsd:selector xpath="data/parameters/*" /> + <xsd:field xpath="@time-layout" /> + </xsd:keyref> + <xsd:key name="timeKey"> + <xsd:selector xpath=".//time-layout" /> + <xsd:field xpath="layout-key" /> + </xsd:key> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="version" type="xsd:string" default="1.0" /> + </xsd:complexType> + </xsd:element> + +</xsd:schema> Added: branches/rel-1/testing/Duncan/weather/ndfd/ndclient.py ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/ndclient.py Mon Sep 10 16:14:20 2007 @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# generate the client and server using ZSI (svn revision 1414) +# The Zolera Soap Infrastructure http://pywebsvcs.sf.net/ +# with: +# wsdl2py --simple-naming http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl + +import sys +import time +from ndfdXML_client import * + +service = ndfdXMLLocator() +#port = service.getndfdXMLPort() +#port = service.getndfdXMLPort(tracefile=sys.stdout) +trace=open('trace.log', 'w') +port = service.getndfdXMLPort(service.getndfdXMLPortAddress(), tracefile=trace) + +req = NDFDgenRequest() +req.latitude = 38.99 +req.longitude = -77.99 +req.product = 'time-series' +#req.weatherParameters = { 'maxt', 'mint' } +#resp = port.NDFDgen(req) + +byday = NDFDgenByDayRequest() +byday.longitude = -77.99 +byday.latitude = 38.99 +byday.startDate = int(time.time()) +byday.numDays = 7 +byday.format = '24hourly' +resp = port.NDFDgenByDay(byday) +trace.close() +print resp.dwmlByDayOut +# the response has invalid xml +# this could be a problem with ZSI or the service. Added: branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML.wsdl ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML.wsdl Mon Sep 10 16:14:20 2007 @@ -0,0 +1,162 @@ +<?xml version="1.0"?> + +<!-- ********************************************************************** + + ndfdXML.wsdl + + John L. Schattel MDL 4 August 2004 + Red Hat Linux Apache Server + + SOURCE CODE CONTROL INFORMATION + + Name: + %PM% + %PID% + + Status: + %PS% + + History: + %PL% + + Change Document History: + %PIRC% + + ************************************************************************* --> + +<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd" +xmlns:tns="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" +xmlns:typens="http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd" +xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"> +<types> + <xsd:schema targetNamespace="http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd"> + <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> + <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> + + <xsd:simpleType name="formatType"> + <xsd:restriction base='xsd:string'> + <xsd:enumeration value='24 hourly'/> + <xsd:enumeration value='12 hourly'/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:simpleType name="productType"> + <xsd:restriction base='xsd:string'> + <xsd:enumeration value='time-series'/> + <xsd:enumeration value='glance'/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:complexType name="weatherParametersType"> + <xsd:all> + <xsd:element name="maxt" type="xsd:boolean"/> + <xsd:element name="mint" type="xsd:boolean"/> + <xsd:element name="temp" type="xsd:boolean"/> + <xsd:element name="dew" type="xsd:boolean"/> + <xsd:element name="pop12" type="xsd:boolean"/> + <xsd:element name="qpf" type="xsd:boolean"/> + <xsd:element name="sky" type="xsd:boolean"/> + <xsd:element name="snow" type="xsd:boolean"/> + <xsd:element name="wspd" type="xsd:boolean"/> + <xsd:element name="wdir" type="xsd:boolean"/> + <xsd:element name="wx" type="xsd:boolean"/> + <xsd:element name="waveh" type="xsd:boolean"/> + <xsd:element name="icons" type="xsd:boolean"/> + <xsd:element name="rh" type="xsd:boolean"/> + <xsd:element name="appt" type="xsd:boolean"/> + <xsd:element name="incw34" type="xsd:boolean"/> + <xsd:element name="incw50" type="xsd:boolean"/> + <xsd:element name="incw64" type="xsd:boolean"/> + <xsd:element name="cumw34" type="xsd:boolean"/> + <xsd:element name="cumw50" type="xsd:boolean"/> + <xsd:element name="cumw64" type="xsd:boolean"/> + <xsd:element name="wgust" type="xsd:boolean"/> + <xsd:element name="conhazo" type="xsd:boolean"/> + <xsd:element name="ptornado" type="xsd:boolean"/> + <xsd:element name="phail" type="xsd:boolean"/> + <xsd:element name="ptstmwinds" type="xsd:boolean"/> + <xsd:element name="pxtornado" type="xsd:boolean"/> + <xsd:element name="pxhail" type="xsd:boolean"/> + <xsd:element name="pxtstmwinds" type="xsd:boolean"/> + <xsd:element name="ptotsvrtstm" type="xsd:boolean"/> + <xsd:element name="pxtotsvrtstm" type="xsd:boolean"/> + </xsd:all> + </xsd:complexType> + +</xsd:schema> +</types> + +<message name="NDFDgenRequest"> + <part name="latitude" type="xsd:decimal" /> + <part name="longitude" type="xsd:decimal" /> + <part name="product" type="typens:productType" /> + <part name="startTime" type="xsd:dateTime" /> + <part name="endTime" type="xsd:dateTime" /> + <part name="weatherParameters" type="typens:weatherParametersType" /> +</message> + +<message name="NDFDgenResponse"> + <part name="dwmlOut" type="xsd:string" /> +</message> + +<message name="NDFDgenByDayRequest"> + <part name="latitude" type="xsd:decimal" /> + <part name="longitude" type="xsd:decimal" /> + <part name="startDate" type="xsd:date" /> + <part name="numDays" type="xsd:integer" /> + <part name="format" type="typens:formatType" /> +</message> + +<message name="NDFDgenByDayResponse"> + <part name="dwmlByDayOut" type="xsd:string" /> +</message> + +<portType name="ndfdXMLPortType"> + + <operation name="NDFDgen"> + <documentation>Returns National Weather Service digital weather forecast data</documentation> + <input message="tns:NDFDgenRequest"/> + <output message="tns:NDFDgenResponse"/> + </operation> + + <operation name="NDFDgenByDay"> + <documentation>Returns National Weather Service digital weather forecast data summarized over either 24- or 12-hourly periods</documentation> + <input message="tns:NDFDgenByDayRequest"/> + <output message="tns:NDFDgenByDayResponse"/> + </operation> + +</portType> + +<binding name="ndfdXMLBinding" type="tns:ndfdXMLPortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + + <operation name="NDFDgen"> + <soap:operation soapAction="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgen" style="rpc"/> + <input> + <soap:body use="encoded" namespace="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + <output> + <soap:body use="encoded" namespace="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </output> + </operation> + + <operation name="NDFDgenByDay"> + <soap:operation soapAction="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDay" style="rpc"/> + <input> + <soap:body use="encoded" namespace="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + <output> + <soap:body use="encoded" namespace="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </output> + </operation> +</binding> + +<service name="ndfdXML"> + <documentation>The service has two exposed functions, NDFDgen and NDFDgenByDay. For the NDFDgen function, the client needs to provide a latitude and longitude pair and the product type. The client also needs to provide the start and end time of the period that it wants data for. For the time-series product, the client needs to provide an array of boolean values corresponding to which weather values should appear in the time series product. For the NDFDgenByDay function, the client needs to provide a latitude and longitude pair, the date it wants to start retrieving data for and the number of days worth of data. The client also needs to provide the format that is desired.</documentation> + + <port name="ndfdXMLPort" binding="tns:ndfdXMLBinding"> + <soap:address location="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php"/> + </port> +</service> + +</definitions> \ No newline at end of file Added: branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_client.py ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_client.py Mon Sep 10 16:14:20 2007 @@ -0,0 +1,103 @@ +################################################## +# file: ndfdXML_client.py +# +# client stubs generated by "ZSI.generate.wsdl2python.WriteServiceModule" +# /usr/bin/wsdl2py --simple-naming http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl +# +################################################## + +from ndfdXML_types import * +import urlparse, types +from ZSI.TCcompound import ComplexType, Struct +from ZSI import client +from ZSI.schema import GED, GTD +import ZSI + +# Locator +class ndfdXMLLocator: + ndfdXMLPort_address = "http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php" + def getndfdXMLPortAddress(self): + return ndfdXMLLocator.ndfdXMLPort_address + def getndfdXMLPort(self, url=None, **kw): + return ndfdXMLBindingSOAP(url or ndfdXMLLocator.ndfdXMLPort_address, **kw) + +# Methods +class ndfdXMLBindingSOAP: + def __init__(self, url, **kw): + kw.setdefault("readerclass", None) + kw.setdefault("writerclass", None) + # no resource properties + self.binding = client.Binding(url=url, **kw) + # no ws-addressing + + # op: NDFDgen + def NDFDgen(self, request, **kw): + if isinstance(request, NDFDgenRequest) is False: + raise TypeError, "%s incorrect request type" % (request.__class__) + # no input wsaction + self.binding.Send(None, None, request, soapaction="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgen", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw) + # no output wsaction + typecode = Struct(pname=None, ofwhat=NDFDgenResponse.typecode.ofwhat, pyclass=NDFDgenResponse.typecode.pyclass) + response = self.binding.Receive(typecode) + return response + + # op: NDFDgenByDay + def NDFDgenByDay(self, request, **kw): + if isinstance(request, NDFDgenByDayRequest) is False: + raise TypeError, "%s incorrect request type" % (request.__class__) + # no input wsaction + self.binding.Send(None, None, request, soapaction="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDay", encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", **kw) + # no output wsaction + typecode = Struct(pname=None, ofwhat=NDFDgenByDayResponse.typecode.ofwhat, pyclass=NDFDgenByDayResponse.typecode.pyclass) + response = self.binding.Receive(typecode) + return response + +class NDFDgenRequest: + def __init__(self, **kw): + """Keyword parameters: + latitude -- part latitude + longitude -- part longitude + product -- part product + startTime -- part startTime + endTime -- part endTime + weatherParameters -- part weatherParameters + """ + self.latitude = kw.get("latitude") + self.longitude = kw.get("longitude") + self.product = kw.get("product") + self.startTime = kw.get("startTime") + self.endTime = kw.get("endTime") + self.weatherParameters = kw.get("weatherParameters") +NDFDgenRequest.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgen"), ofwhat=[ZSI.TC.Decimal(pname="latitude", aname="latitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TC.Decimal(pname="longitude", aname="longitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.productType_(pname="product", aname="product", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDateTime(pname="startTime", aname="startTime", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDateTime(pname="endTime", aname="endTime", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.weatherParametersType_(pname="weatherParameters", aname="weatherParameters", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True! )], pyclass=NDFDgenRequest, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenResponse: + def __init__(self, **kw): + """Keyword parameters: + dwmlOut -- part dwmlOut + """ + self.dwmlOut = kw.get("dwmlOut") +NDFDgenResponse.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenResponse"), ofwhat=[ZSI.TC.String(pname="dwmlOut", aname="dwmlOut", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenResponse, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenByDayRequest: + def __init__(self, **kw): + """Keyword parameters: + latitude -- part latitude + longitude -- part longitude + startDate -- part startDate + numDays -- part numDays + format -- part format + """ + self.latitude = kw.get("latitude") + self.longitude = kw.get("longitude") + self.startDate = kw.get("startDate") + self.numDays = kw.get("numDays") + self.format = kw.get("format") +NDFDgenByDayRequest.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenByDay"), ofwhat=[ZSI.TC.Decimal(pname="latitude", aname="latitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TC.Decimal(pname="longitude", aname="longitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDate(pname="startDate", aname="startDate", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCnumbers.Iinteger(pname="numDays", aname="numDays", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.formatType_(pname="format", aname="format", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenByDayRequest, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenByDayResponse: + def __init__(self, **kw): + """Keyword parameters: + dwmlByDayOut -- part dwmlByDayOut + """ + self.dwmlByDayOut = kw.get("dwmlByDayOut") +NDFDgenByDayResponse.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenByDayResponse"), ofwhat=[ZSI.TC.String(pname="dwmlByDayOut", aname="dwmlByDayOut", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenByDayResponse, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") Added: branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_server.py ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_server.py Mon Sep 10 16:14:20 2007 @@ -0,0 +1,87 @@ +################################################## +# file: ndfdXML_server.py +# +# skeleton generated by "ZSI.generate.wsdl2dispatch.ServiceModuleWriter" +# /usr/bin/wsdl2py --simple-naming http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl +# +################################################## + +from ZSI.schema import GED, GTD +from ZSI.TCcompound import ComplexType, Struct +from ndfdXML_types import * +from ZSI.ServiceContainer import ServiceSOAPBinding + +# Messages +class NDFDgenRequest: + def __init__(self, **kw): + """Keyword parameters: + latitude -- part latitude + longitude -- part longitude + product -- part product + startTime -- part startTime + endTime -- part endTime + weatherParameters -- part weatherParameters + """ + self.latitude = kw.get("latitude") + self.longitude = kw.get("longitude") + self.product = kw.get("product") + self.startTime = kw.get("startTime") + self.endTime = kw.get("endTime") + self.weatherParameters = kw.get("weatherParameters") +NDFDgenRequest.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgen"), ofwhat=[ZSI.TC.Decimal(pname="latitude", aname="latitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TC.Decimal(pname="longitude", aname="longitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.productType_(pname="product", aname="product", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDateTime(pname="startTime", aname="startTime", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDateTime(pname="endTime", aname="endTime", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.weatherParametersType_(pname="weatherParameters", aname="weatherParameters", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True! )], pyclass=NDFDgenRequest, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenResponse: + def __init__(self, **kw): + """Keyword parameters: + dwmlOut -- part dwmlOut + """ + self.dwmlOut = kw.get("dwmlOut") +NDFDgenResponse.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenResponse"), ofwhat=[ZSI.TC.String(pname="dwmlOut", aname="dwmlOut", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenResponse, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenByDayRequest: + def __init__(self, **kw): + """Keyword parameters: + latitude -- part latitude + longitude -- part longitude + startDate -- part startDate + numDays -- part numDays + format -- part format + """ + self.latitude = kw.get("latitude") + self.longitude = kw.get("longitude") + self.startDate = kw.get("startDate") + self.numDays = kw.get("numDays") + self.format = kw.get("format") +NDFDgenByDayRequest.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenByDay"), ofwhat=[ZSI.TC.Decimal(pname="latitude", aname="latitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TC.Decimal(pname="longitude", aname="longitude", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCtimes.gDate(pname="startDate", aname="startDate", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), ZSI.TCnumbers.Iinteger(pname="numDays", aname="numDays", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True), www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.formatType_(pname="format", aname="format", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenByDayRequest, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + +class NDFDgenByDayResponse: + def __init__(self, **kw): + """Keyword parameters: + dwmlByDayOut -- part dwmlByDayOut + """ + self.dwmlByDayOut = kw.get("dwmlByDayOut") +NDFDgenByDayResponse.typecode = Struct(pname=("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl","NDFDgenByDayResponse"), ofwhat=[ZSI.TC.String(pname="dwmlByDayOut", aname="dwmlByDayOut", typed=False, encoded=None, minOccurs=1, maxOccurs=1, nillable=True)], pyclass=NDFDgenByDayResponse, encoded="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl") + + +# Service Skeletons +class ndfdXML(ServiceSOAPBinding): + soapAction = {} + root = {} + + def __init__(self, post='/forecasts/xml/SOAP_server/ndfdXMLserver.php', **kw): + ServiceSOAPBinding.__init__(self, post) + + def soap_NDFDgen(self, ps, **kw): + request = ps.Parse(NDFDgenRequest.typecode) + return request,NDFDgenResponse() + + soapAction['http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgen'] = 'soap_NDFDgen' + root[(NDFDgenRequest.typecode.nspname,NDFDgenRequest.typecode.pname)] = 'soap_NDFDgen' + + def soap_NDFDgenByDay(self, ps, **kw): + request = ps.Parse(NDFDgenByDayRequest.typecode) + return request,NDFDgenByDayResponse() + + soapAction['http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDay'] = 'soap_NDFDgenByDay' + root[(NDFDgenByDayRequest.typecode.nspname,NDFDgenByDayRequest.typecode.pname)] = 'soap_NDFDgenByDay' + Added: branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_types.py ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/ndfd/ndfdXML_types.py Mon Sep 10 16:14:20 2007 @@ -0,0 +1,88 @@ +################################################## +# file: ndfdXML_types.py +# +# schema types generated by "ZSI.generate.wsdl2python.WriteServiceModule" +# /usr/bin/wsdl2py --simple-naming http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl +# +################################################## + +import ZSI +import ZSI.TCcompound +from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED + +############################## +# targetNamespace +# http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd +############################## + +class www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd: + targetNamespace = "http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd" + + class formatType_(ZSI.TC.String, TypeDefinition): + schema = "http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd" + type = (schema, "formatType") + def __init__(self, pname, **kw): + ZSI.TC.String.__init__(self, pname, pyclass=None, **kw) + class Holder(str): + typecode = self + self.pyclass = Holder + + class productType_(ZSI.TC.String, TypeDefinition): + schema = "http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd" + type = (schema, "productType") + def __init__(self, pname, **kw): + ZSI.TC.String.__init__(self, pname, pyclass=None, **kw) + class Holder(str): + typecode = self + self.pyclass = Holder + + class weatherParametersType_(ZSI.TCcompound.ComplexType, TypeDefinition): + schema = "http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd" + type = (schema, "weatherParametersType") + def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw): + ns = www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd.weatherParametersType_.schema + TClist = [ZSI.TC.Boolean(pname="maxt", aname="maxt", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="mint", aname="mint", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="temp", aname="temp", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="dew", aname="dew", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="pop12", aname="pop12", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="qpf", aname="qpf", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="sky", aname="sky", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="snow", aname="snow", minOccurs=1, maxOccurs=1, nillable=False, typ! ed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="wspd", aname="wspd", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="wdir", aname="wdir", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="wx", aname="wx", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="waveh", aname="waveh", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="icons", aname="icons", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="rh", aname="rh", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="appt", aname="appt", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="incw34", aname="incw34", minOccurs=1, maxOccurs=1,! nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boole an(pname="incw50", aname="incw50", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="incw64", aname="incw64", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="cumw34", aname="cumw34", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="cumw50", aname="cumw50", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="cumw64", aname="cumw64", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="wgust", aname="wgust", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="conhazo", aname="conhazo", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="ptornado", aname="ptornado", minOccurs=1, maxOccurs=1, nillable=False! , typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="phail", aname="phail", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="ptstmwinds", aname="ptstmwinds", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="pxtornado", aname="pxtornado", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="pxhail", aname="pxhail", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="pxtstmwinds", aname="pxtstmwinds", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="ptotsvrtstm", aname="ptotsvrtstm", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.Boolean(pname="pxtotsvrtstm", aname="pxtotsvrtstm", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("enc! oded"))] + self.attribute_typecode_dict = attributes or {} + if extend: TClist += ofwhat + if restrict: TClist = ofwhat + ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw) + class Holder: + typecode = self + def __init__(self): + # pyclass + self.maxt = None + self.mint = None + self.temp = None + self.dew = None + self.pop12 = None + self.qpf = None + self.sky = None + self.snow = None + self.wspd = None + self.wdir = None + self.wx = None + self.waveh = None + self.icons = None + self.rh = None + self.appt = None + self.incw34 = None + self.incw50 = None + self.incw64 = None + self.cumw34 = None + self.cumw50 = None + self.cumw64 = None + self.wgust = None + self.conhazo = None + self.ptornado = None + self.phail = None + self.ptstmwinds = None + self.pxtornado = None + self.pxhail = None + self.pxtstmwinds = None + self.ptotsvrtstm = None + self.pxtotsvrtstm = None + return + Holder.__name__ = "weatherParametersType_Holder" + self.pyclass = Holder + +# end class www_weather_gov_forecasts_xml_DWMLgen_schema_DWML_xsd (tns: http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd) Added: branches/rel-1/testing/Duncan/weather/yahoo/yahoo.py ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/yahoo/yahoo.py Mon Sep 10 16:14:20 2007 @@ -0,0 +1,49 @@ +#!/usr/bin/env python +import cElementTree as ET +# +# using yahoo weather +# wget 'http://weather.yahooapis.com/forecastrss?p=SZXX0033&u=c' +#text=open('yahoo.xml').read() +#ET.XML(text) +#tree=ET.XML(text) +tree=ET.parse('yahoo.xml') + +ns1='http://xml.weather.yahoo.com/ns/rss/1.0' +ns2='http://www.w3.org/2003/01/geo/wgs84_pos#' + +ns = { + 'ns1': ns1, 'ns2': ns2 +} + +elements = { + './/{%(ns2)s}long' % ns : 'long', + './/{%(ns2)s}lat' % ns : 'lat', + './/{%(ns1)s}location' % ns : 'location', + './/{%(ns1)s}atmosphere' % ns : 'atmosphere', + './/{%(ns1)s}astronomy' % ns : 'astronomy', + './/{%(ns1)s}units' % ns : 'units', + './/{%(ns1)s}wind' % ns : 'wind', + './/{%(ns1)s}forecast' % ns : 'forecast', + './/ttl' : 'ttl', + './/lastBuildDate' : 'lastBuildDate', +} +#print elements + + +def iterparent(tree): + for parent in tree.getiterator(): + for child in parent: + yield parent, child + +res = {} +for parent, child in iterparent(tree): + print child, child.text, child.items() + +print res + +for k,v in elements.items(): + res[v] = tree.findall(k) + +for k,v in res.items(): + for item in v: + print k, item.text, item.items() Added: branches/rel-1/testing/Duncan/weather/yahoo/yahoo.xml ============================================================================== --- (empty file) +++ branches/rel-1/testing/Duncan/weather/yahoo/yahoo.xml Mon Sep 10 16:14:20 2007 @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <title>Yahoo! Weather - Zurich, SZ</title> + <link>http://us.rd.yahoo.com/dailynews/rss/weather/Zurich__SZ/*http://weather.yahoo.com/forecast/SZXX0033_c.html</link> + <description>Yahoo! Weather for Zurich, SZ</description> + <language>en-us</language> + <lastBuildDate>Mon, 10 Sep 2007 7:20 pm CEST</lastBuildDate> + <ttl>60</ttl> + <yweather:location city="Zurich" region="" country="SZ" /> + <yweather:units temperature="C" distance="km" pressure="mb" speed="kph" /> + <yweather:wind chill="16" direction="300" speed="19" /> + <yweather:atmosphere humidity="59" visibility="999" pressure="0" rising="0" /> + <yweather:astronomy sunrise="6:56 am" sunset="7:49 pm" /> + <image> + <title>Yahoo! Weather</title> + <width>142</width> + <height>18</height> + <link>http://weather.yahoo.com/</link> + <url>http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url> + </image> + <item> + <title>Conditions for Zurich, SZ at 7:20 pm CEST</title> + <geo:lat>47.38</geo:lat> + <geo:long>8.54</geo:long> + <link>http://us.rd.yahoo.com/dailynews/rss/weather/Zurich__SZ/*http://weather.yahoo.com/forecast/SZXX0033_c.html</link> + <pubDate>Mon, 10 Sep 2007 7:20 pm CEST</pubDate> + <yweather:condition text="Mostly Cloudy" code="28" temp="16" date="Mon, 10 Sep 2007 7:20 pm CEST" /> + <description><![CDATA[ +<img src="http://l.yimg.com/us.yimg.com/i/us/we/52/28.gif" /><br /> + <b>Current Conditions:</b><br /> + Mostly Cloudy, 16 C<BR /><BR /> + <b>Forecast:</b><BR /> + Mon - Showers Late. High: 20 Low: 8<br /> + Tue - AM Fog/PM Clouds. High: 16 Low: 6<br /> + <br /> +<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Zurich__SZ/*http://weather.yahoo.com/forecast/SZXX0033_c.html">Full Forecast at Yahoo! Weather</a><BR/> + (provided by The Weather Channel)<br/> + ]]></description> + <yweather:forecast day="Mon" date="10 Sep 2007" low="8" high="20" text="Showers Late" code="45" /> +<yweather:forecast day="Tue" date="11 Sep 2007" low="6" high="16" text="AM Fog/PM Clouds" code="20" /> + <guid isPermaLink="false">SZXX0033_2007_09_10_19_20_CEST</guid> + </item> +</channel> +</rss><!-- p5.weather.dcn.yahoo.com uncompressed Mon Sep 10 10:46:58 PDT 2007 --> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Freevo-cvslog mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog
