Skip to main content

Python client for the Product Sustainability & Impact Assessment API (sustainability, CO2, water, CBAM).

Project description

ecoscore-sdk

Python client for the Product Sustainability & Impact Assessment API. Get sustainability scores, CO2 estimates, and water usage for products in a few lines of code—ideal for e-commerce, dashboards, and AI agents.

Get your free API key: RapidAPI – Product Sustainability & Impact Assessment API (replace with your actual RapidAPI API page URL once listed)


Install

pip install ecoscore-sdk

Quick start

from ecoscore import EcoClient

client = EcoClient(
    api_key="YOUR_API_KEY",           # from RapidAPI
    base_url="https://yourapp.railway.app",  # your API base URL
)
impact = client.assess_impact(product="T-Shirt", material="Cotton")
print(impact.co2_estimate)              # e.g. 1.15
print(impact.total_sustainability_score)
print(impact.water_usage_liters)

Or use environment variables:

export ECOSCORE_API_KEY=your_key
export ECOSCORE_BASE_URL=https://yourapp.railway.app
from ecoscore import EcoClient

client = EcoClient()
impact = client.assess_impact(product="Eco T-Shirt", material="Organic Cotton", weight_kg=0.2)
print(impact.co2_estimate)
print(impact.cbam_relevant)
print(impact.limitations)

API

EcoClient(api_key=None, base_url=None)

  • api_key: Your API key (from RapidAPI or your provider). Can be omitted if ECOSCORE_API_KEY is set.
  • base_url: API root URL (e.g. https://yourapp.railway.app). Can be omitted if ECOSCORE_BASE_URL is set.

assess_impact(product, material, weight_kg=0.2, origin_country="CN", destination_country="US")

  • product: Product name (string).
  • material: Single material name (e.g. "Cotton", "Recycled Polyester") or a dict of shares, e.g. {"cotton": 0.6, "polyester": 0.4}.
  • weight_kg: Weight in kilograms (default 0.2).
  • origin_country: Production country (default "CN").
  • destination_country: Delivery country (default "US").

Returns an ImpactResult with:

  • co2_estimate / co2_estimate_kg — CO2 equivalent (kg)
  • water_usage_liters — Water use (liters)
  • total_sustainability_score — 0–100 score
  • breakdownmaterial_score, logistics_score, weight_impact
  • cbam_relevant — Whether the product contains CBAM-relevant materials
  • limitations — Disclaimer text (internal use, not for regulatory filings)

get_methodology()

Returns the calculation methodology (formulas, weights, disclaimer) as a dict.


Where to get the API key

This SDK talks to the Product Sustainability & Impact Assessment API. To use it:

  1. Go to RapidAPI and find the Product Sustainability & Impact Assessment API (or use the link on the API’s GitHub repo). Subscribe to the free tier and copy your API key.
  2. Copy your API key and your base URL (if provided).
  3. Pass them into EcoClient(api_key="...", base_url="...") or set ECOSCORE_API_KEY and ECOSCORE_BASE_URL.

License

MIT.

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

ecoscore_sdk-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecoscore_sdk-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file ecoscore_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: ecoscore_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ecoscore_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b03f03e7221e30a14606beffd3f88de8146a59c2adf31cc3faac48b94b7493ce
MD5 51016ab46875630044a2f4bb9107b5d2
BLAKE2b-256 60577ce9dab2b62e622de38e2b48a9669219ab4321e72af6831c163d959ac348

See more details on using hashes here.

File details

Details for the file ecoscore_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ecoscore_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ecoscore_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cabdc252ff0ed864ef21dde54b1d2e65fbcef778cabe1cb6d10209a9a91834d
MD5 a11b4e669b39bfb90cfeebd5720a05f0
BLAKE2b-256 593c0a03bbea2ade8301ce8431ff588546577440ed7d9414483699c8fc110291

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page