Skip to main content

An API utility wrapper for accessing the e-Manifest hazardous waste tracking system maintained by the US Environmental Protection Agency

Project description

e-Manifest

Downloads PyPI License: CC0-1.0

emanifest is a client library for accessing the e-Manifest REST APIs of the US Environmental Protection Agency's RCRAInfo national electronic hazardous waste management system.

Note: The emanifest package was substantially refactored after version 1.1.0 and was released as a new major version at 2.0.0. Code relying on version 1.1.0 should not upgrade to version 2.0.0 of this package without refactoring.

Contents

Requirements

  • Python 3.6

Dependencies

  • requests
  • requests_toolbelt

Installation

emanifest can be installed directly from the Python package directory using pip:

pip install emanifest

Usage

Getting Started

Before using the emanifest package, ensure you have a RCRAInfo user account and the necessary permissions to generate an API ID and key.

All methods to access the e-Manifest APIs are implemented by the RcrainfoClient class which needs to be authenticated with your API ID and Key. A new instance of the class can be initiated with the new_client() convenience function like so:

from emanifest import client as em

rcra_client = em.new_client('preprod')
rcra_client.Auth('YOUR_API_ID', 'YOUR_API_KEY')

new_client() accepts a string, either preprod, prod, or a complete base URL. To register for a testing account in preproduction, visit the preprod site. The RcrainfoClient stores the JSON web token and its expiration period (20 minutes). Currently, the emanifest python package does not automatically reauthenticate.

Methods

After authenticating, you are ready to use the full functionality of the emanifest package. An introductory example script can be found here. The RcrainfoClient class exposes a method for each API endpoint in one of the 10 service catagories. For more information about these services, visit the Swagger page of your selected environment. (PREPROD, PROD). API endpoints designed for use by other groups, such as regulators or industry users, will return 'Access Denied' errors if you are not authorized to access these resources in RCRAInfo.

  1. [All users] Authentication services
  2. [All users] e-Manifest Lookup Services
  3. [All users] Lookup Services
  4. [All users] Site Services
  5. [Industry users] e-Manifest Services
  6. [Industry users] e-Manifest UI Link Services
  7. [Regulator users] CM&E Evaluation Services
  8. [Regulator users] e-Manifest Services
  9. [Regulator users] Handler Services
  10. [Regulator users] User Services

Content will be returned as a RcraResponse object, which wraps around the requests.Response object. Methods that download file attachments are decoded and returned in the RcrainfoResponse.multipart_json and RcrainfoResponse.multipart_zip when appropriate. The entire request.Response object is returned in RcrainfoResponse.response. Methods that update, correct, or save manifests by uploading new .json and/or .zip files require a file path.

Examples:

rcra_client.GetSiteDetails('VATEST000001')

Once you've confirmed this is the correct site, you might search for manifests in transit from that site:

rcra_client.SearchMTN(siteId='VATEST000001', status='InTransit')

If one of those manifests didn't match your records, you could initiate a correction with the correct JSON information and optionally any attachments (.zip):

rcra_client.Correct('manifest_file_name.json', 'optional_attachments.zip')

Help

If you are uncertain how to use a function, run help(em.FunctionName) in your Python environment. This will return a description of the function, any required inputs, and the formats of those inputs. For a list of all the functions contained in emanifest and additional information about this package, run help(emanifest) in your Python environment.

Contact

Please direct questions to the EPA e-Manifest team at USEPA/e-manifest

Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emanifest-2.0.5.tar.gz (12.1 kB view hashes)

Uploaded source

Built Distribution

emanifest-2.0.5-py3-none-any.whl (10.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page