Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ZeroCarbon Python SDK

Official Python client for ZeroCarbon.codes - India's leading Carbon Accounting & Offsetting API.

Installation

pip install zerocarbon-python-sdk

Quick Start

fromzerocarbonimportZeroCarbon# Initialize clientclient=ZeroCarbon(api_key="YOUR_API_KEY")
# Calculate flight emissionsemissions=client.calculate.flight(
origin="DEL",
destination="BOM",
cabin_class="economy"
)
print(f"Emissions: {emissions['emissions_kg_co2e']} kg CO2e")
# Get offset recommendationsoffsets=client.offsets.get_recommendations(
emissions_kg_co2e=emissions['emissions_kg_co2e'],
preferred_region="India"
)
print(f"Top project: {offsets['recommendations'][0]['name']}")
# Purchase and retire creditstransaction=client.offsets.purchase(
project_id=offsets['recommendations'][0]['project_id'],
quantity_kg_co2e=emissions['emissions_kg_co2e'],
retirement_reason="Business flight offsetting"
)
print(f"Certificate: {transaction['certificate_url']}")

Features

  • ✅ Calculate emissions from flights, electricity, fuel, and more
  • ✅ AI-powered spend-based emission matching
  • ✅ Carbon offset recommendations
  • ✅ Purchase and retire carbon credits
  • ✅ Generate BRSR-compliant reports
  • ✅ Webhook support
  • ✅ Test mode for development

Documentation

Full documentation: https://docs.zerocarbon.codes

Examples

Calculate Electricity Emissions

emissions=client.calculate.electricity(
amount_kwh=1000,
country="IN",
state="Maharashtra"
)
# Returns: 820 kg CO2e (using India grid factor)

Smart Spend Matching

emissions=client.calculate.spend(
amount=100000,
currency="INR",
category="electricity",
description="Monthly office electricity bill"
)
# AI automatically matches to emission factors

Generate BRSR Report

report=client.brsr.generate_report(
company_id="comp_123",
financial_year="2024-25",
format="pdf"
)
print(report['download_url'])

Test Mode

Enable test mode to avoid real charges:

client=ZeroCarbon(
api_key="test_YOUR_API_KEY",
test_mode=True
)

License

MIT License - see LICENSE file for details.

Support

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages