Created
September 29, 2019 22:38
-
-
Save cherdt/f86cfbf1e5c8a2de9ea8ecc0bdd20047 to your computer and use it in GitHub Desktop.
A SOAP request example using Python's zeep library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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