Getting Started

Installation

To use ec3-python-wrapper, first install it using pip:

$ pip install ec3-python-wrapper

Authentication

Usage of the EC3 Python Wrapper assumes you have obtained a bearer token from Building Transparency. To obtain your token follow the instructions found here

Your token should be securely stored. A common way to do this, is to store it as an environment variable, and load it using os.environ:

import os
api_key = os.environ["EC3_KEY"]

Quickstart

The following is a simple example of querying for a list of materials. Refer to the Building Transparency API documentation for valid fields to search.

>>> import os
>>> from ec3 import EC3Materials
>>> token = os.environ['EC3_KEY']
>>> ec3_materials = EC3Materials(bearer_token=token, ssl_verify=False)
>>> mat_param_dict = {"lightweight":True, "concrete_compressive_strength_at_28d__target":"5000 psi", "jurisdiction":"US"}
>>> ec3_materials.return_fields = ["id", "concrete_compressive_strength_28d", "gwp"]
>>> mat_records = ec3_materials.get_materials(return_all=True, params=mat_param_dict)

Examples

Some Jupyter Notebook examples can be found over in the github repository: