Skip to content

Instantly share code, notes, and snippets.

@dagg
Created August 7, 2018 15:21
Show Gist options
  • Save dagg/2c18cfdd0f8aab3821a92136116408cd to your computer and use it in GitHub Desktop.
Save dagg/2c18cfdd0f8aab3821a92136116408cd to your computer and use it in GitHub Desktop.
# zeep needs to be installed
from zeep import Client, helpers
from zeep.wsse.username import UsernameToken
# We use google weather's WSDL to test our script
client = Client('https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl')
# the request to the web service will be sent with the zipCodeList argument (we give the value 90210 to the zipcode argument)
req = {"zipCodeList": 90210}
# the response from calling the LatLonListZipCode method (give zipcode to get lat and lon)
resp = client.service.LatLonListZipCode(**req)
'''
The response will be something like that:
"<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='https://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd'><latLonList>34.0995,-118.414</latLonList></dwml>"
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment