# Get the list of Sites from the service
# --------------------------------------
print 'Get the list of sites.'
print '----------------------'
sitesResult = service.GetSitesObject('')
siteCount = len(sitesResult.site)
print 'In the selected service there are ' + str(siteCount) + ' Sites.\n'
for x in sitesResult.site:
    print(x.siteInfo.siteCode[0].value + ': ' + x.siteInfo.siteName)

# Get SiteInfo for a selected Site
# ---------------------------------------
print '\nGet information about a selected site.'
print '----------------------------------------'
siteCode = 'LR_Mendon_AA'
siteInfoResult = service.GetSiteInfoObject(networkCode + ':' + siteCode)
siteName = siteInfoResult.site[0].siteInfo.siteName
numSeries = len(siteInfoResult.site[0].seriesCatalog[0].series)
print('At the ' + siteName + ' Site there are ' + str(numSeries) +
      ' measured variables.\n')
for x in siteInfoResult.site[0].seriesCatalog[0].series:
    print(x.variable.variableCode[0].value + ': ' + x.variable.variableName)

# Get the list of Variables from the service
# --------------------------------------
print '\nGet the list of Variables.'
print '--------------------------'
variablesResult = service.GetVariablesObject('')
variablesCount = len(variablesResult.variables.variable)
print 'In the selected service there are ' + str(
    variablesCount) + ' Variables.\n'
Example #2
0
# -*- coding: utf-8 -*-
from suds.client import Client

#Create a new object named NWIS for calling the web service methods (https://fedorahosted.org/suds/wiki/Documentation)
NWIS = Client(
    "http://river.sdsc.edu/wateroneflow/NWIS/UnitValues.asmx?WSDL").service

#Call the GetSiteInfoObject method (http://river.sdsc.edu/wateroneflow/NWIS/UnitValues.asmx?op=GetSiteInfo)
response = NWIS.GetSiteInfoObject("USGS:10109000")

#print the site’s name to the console
print response.site[0].siteInfo.siteName
#(this should produce the following output)
#LOGAN RIVER ABOVE STATE DAM, NEAR LOGAN, UT
# Example of calling GetSiteInfoObject from a WaterOneFlow web service
from suds.client import Client

# Create a new object named "NWIS" for calling the web
# service methods using the suds client module
NWIS = Client(
    'http://hydroportal.cuahsi.org/nwisuv/cuahsi_1_1.asmx?WSDL').service

# Call the GetSiteInfoObject method
response = NWIS.GetSiteInfoObject('NWISUV:10109000')

# Get the site's name from the response
siteName = response.site[0].siteInfo.siteName

# Print the site's name to the console
print siteName

# (this should produce the following output)
# LOGAN RIVER ABOVE STATE DAM, NEAR LOGAN, UT