Skip to content

Files

Latest commit

 

History

History
51 lines (33 loc) · 1.37 KB

File metadata and controls

51 lines (33 loc) · 1.37 KB

Ecoindex python

Validate project quality PyPI - Version PyPI - Downloads

This basic module provides a simple interface to get the Ecoindex based on 3 parameters:

  • The number of DOM elements in the page
  • The size of the page
  • The number of external requests of the page

Requirements

  • Python ^3.10 with pip

Install

pip install ecoindex_compute

Use

Compute ecoindex

You can easily compute the ecoindex by calling the function compute_ecoindex():

(function) compute_ecoindex: (dom: int, size: float, requests: int) -> Coroutine[Any, Any, Ecoindex]

Example:

import asyncio
from pprint import pprint

from ecoindex.compute import compute_ecoindex

# Get ecoindex from DOM elements, size of page and requests of the page
ecoindex = asyncio.run(compute_ecoindex(nodes=100, size=100, requests=100))
pprint(ecoindex)

Result example:

Ecoindex(grade='B', score=72.0, ges=1.56, water=2.34, ecoindex_version='3.0.0')