EPA Web Services Example

The EPA provides a number of web services described here: https://www.epa.gov/waterdata/waters-web-services. Let's take a look at the last one, the Watershed Characterization Service, which provides a number of attributes for a catchment we provide.


In [2]:
import os
import requests
import json

In [3]:
url = 'http://ofmpub.epa.gov/waters10/Watershed_Characterization.Control'
payload = {'pComID':'4795168',
           'optOutFormat':'JSON',
           'optOutPrettyPrint':'1'
          }
response = requests.get(url,payload)

In [ ]:
url =

In [14]:
j = response.content

In [15]:
j


Out[15]:
'<HTML>\n<HEAD>\n<TITLE>Redirect</TITLE>\n</HEAD>\n<BODY>\n<SCRIPT>location.href="https://watersgeo.epa.gov/watershedreport/?comid=4795168";</SCRIPT>\nIf you are not forwarded automatically, please click the following link: \n<A HREF="https://watersgeo.epa.gov/watershedreport/?comid=4795168">https://watersgeo.epa.gov/watershedreport/?comid=4795168</A>\n</BODY>\n</HTML>\n'

In [16]:
response.url


Out[16]:
u'https://ofmpub.epa.gov/waters10/Watershed_Characterization.Control?optOutFormat=JSON&optOutPrettyPrint=1&pComID=4795168'