CarbonTracer API Python Client
This is a Python client for CarbonTracer. It is a wrapper around the CarbonTracer REST API, which allows you to calculate CO2 equivalents for personal transport.
Installation
pip install pycarbontracer
Usage
from pycarbontracer import CarbonTracer
# Create a new CarbonTracer instance
ct = CarbonTracer("YOUR_API_KEY")
# Or use CarbonTracer.from_config() if you have a config.ini in the format of config.dist.ini
# Calculate the CO2 equivalents for a train trip from Graz to Vienna
result = ct.routing("train", "8010 Graz", "1010 Wien")
# Print the result
print(f"CO2 equivalents: {result["response"]["data"]["co2eq"]} {result["response"]["data"]["unitco2eq"]}")
The CarbonTracer class also has methods for the location, address and co2only endpoints, as documented in the CarbonTracer API documentation. The documentation also includes information about the input and output parameters, so make sure to check it out.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pycarbontracer 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycarbontracer-0.9.1.tar.gz | 10.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycarbontracer-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 MB
Release files / pycarbontracer-0.9.1.tar.gz
| Download URL | pycarbontracer-0.9.1.tar.gz |
|---|---|
| Size | 10.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54a4fd49096aa45b3e1d9338984e9b1adf9e42fa51500b7b1b56ca31c32724c4
|
|
BLAKE2b-256 checksum How to use checksums |
7e100e4635d15f58a8c9d7c2e5debf21c749f0b14ea7e6d1e3aa751c7ff0ceb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / pycarbontracer-0.9.1-py3-none-any.whl
| Download URL | pycarbontracer-0.9.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00a084737612d8f8e972c0d4bb4550f65a82d3e1679f19c7b15c7f3ea4db1b97
|
|
BLAKE2b-256 checksum How to use checksums |
c423ce30d16e46db46eb8214afd7a67d7a4566bf2f1bc20e60f8b374d26fc55b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|