Code examples for interacting with the Environmental Protection Agency (EPA) Facility Registry Service (FRS) using the REST API
Python code examples demonstrate how to use the swagger client REST API
to query the EPA Facility Registry Service (FRS). General information
about EPA FRS can be found here at this URL:
https://www.epa.gov/frs/facility-registry-service-frs-api
Technical documentation for the REST Query API can be found at this URL:
https://frsquerypre-api.epa.gov/facilityiptquery/swagger-ui/index.html
- Download and install the swagger client REST API code
I have uploaded two ZIP files above frs-preprod-query-python-client-generated.zip and frs-preprod-submit-python-client-generated.zip that contain the Python version of the Swagger client code. However if changes are made to the API, the Swagger Python client should be re-generated from the source.To generate the Python Client:
- Visit https://editor.swagger.io/ and Clear the editor
- Open the Query Swagger client: https://frsquerypre-api.epa.gov/facilityiptquery/swagger-v1.json
- Copy the contents and paste them into the Swagger editor. You may be prompted to convert the JSON into YAML. Click OK.
- Pull down the Generate Client menu and choose "Python". The python-client-generated.zip file will be downloaded.
- Move the python-client-generated.zip file to a suitable directory and unzip.
- Follow the instructions in the README.md file to build and install the client.
- Obtain a NAAS username and password from nodehelpdesk@epacdx.net
In the request indicate the provisioning option to receive from and/or submit data to the FRS the partner system. - Save the NAAS user id and password in a file named credentials.py
user_id = 'Your NAAS username here' password = 'Your NAAS password here'
- Select the appropriate pre-production (testing) or Production server URL
- Pre-production:
Query: https://frsquerypre-api.epa.gov/facilityiptquery/swagger-ui/index.html
Submit: https://frssubmitpre-api.epa.gov/facilityiptsubmit/swagger-ui/index.html
- Production:
Query: https://frsqueryprd-api.epa.gov/facilityiptqueryprd/swagger-ui/index.html
Submit: https://frssubmitprd-api.epa.gov/facilityiptsubmitprd/swagger-ui/index.html
- Pre-production:
- Make sure the NAAS account has permissions to use the appropriate server and service.
- Now you should be able to run queries against the FRS test or production system. Also, if you have the permissions, you should be able to contribute data to the FRS.