Skip to content

Instantly share code, notes, and snippets.

@cherdt
Created September 29, 2019 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cherdt/f86cfbf1e5c8a2de9ea8ecc0bdd20047 to your computer and use it in GitHub Desktop.
Save cherdt/f86cfbf1e5c8a2de9ea8ecc0bdd20047 to your computer and use it in GitHub Desktop.
A SOAP request example using Python's zeep library
# Example SOAP request using Python's zeep library
# Send a ZIP code, return latitude and longitude coordinates
from zeep import Client
import xml.etree.ElementTree as xml
client = Client('https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl')
result = client.service.LatLonListZipCode('55403')
print("\n\nSOAP response (XML):")
print(result)
# Print just the latitude and longitude, without the XML
lat_long = xml.fromstring(result)[0].text
print("\n\nValues extracted from XML:")
print(lat_long)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment