Skip to main content

Python SDK for 1ClickImpact API

Project description

🌱 MakeImpact Python SDK

PyPI version License: MIT Python

Official Python SDK for 1ClickImpact - Easily integrate impact actions into your Python applications

📦 Installation

pip install makeimpact
# or
poetry add makeimpact

🚀 Getting Started

You'll need an API key to use this SDK. You can get your API key from the 1ClickImpact Account API Keys page.

from makeimpact import OneClickImpact, Environment

# Initialize the SDK with your API key (production environment by default)
sdk = OneClickImpact("your_api_key")

# Create environmental impact with just a few lines of code
sdk.plant_tree(amount=1)
sdk.clean_ocean(amount=5)
sdk.capture_carbon(amount=2)

🌍 Environmental Impact Actions

🌳 Plant Trees

Help combat deforestation and climate change by planting trees.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Plant a single tree
sdk.plant_tree(amount=1)

# Plant trees with a specific category
sdk.plant_tree(amount=10, category="food")

# Plant trees with customer tracking
sdk.plant_tree(
    amount=5,
    customer_email="customer@example.com",
    customer_name="John Doe"
)

🌊 Clean Ocean Plastic

Remove plastic waste from our oceans to protect marine life.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Clean 5 pounds of ocean plastic
sdk.clean_ocean(amount=5)

# Clean ocean plastic with customer tracking
sdk.clean_ocean(
    amount=10,
    customer_email="customer@example.com",
    customer_name="John Doe"
)

♻️ Capture Carbon

Reduce greenhouse gas emissions by capturing carbon.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Capture 2 pounds of carbon
sdk.capture_carbon(amount=2)

# Capture carbon with customer tracking
sdk.capture_carbon(
    amount=5,
    customer_email="customer@example.com",
    customer_name="John Doe"
)

💰 Donate Money

Support any cause through direct monetary donations.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Donate $1.00 (amount in cents)
sdk.donate_money(amount=100)

# Donate with customer tracking
sdk.donate_money(
    amount=500,  # $5.00
    customer_email="customer@example.com",
    customer_name="John Doe"
)

Note: To set up a custom cause for donations, please contact 1ClickImpact directly. All causes must be vetted and approved to ensure they meet their standards for transparency and impact.

📊 Data Access & Reporting

Get Records

Retrieve impact records with optional filtering.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Get all records
records = sdk.get_records()

# Filter records by type
tree_records = sdk.get_records(filter_by="tree_planted")

# Filter records by date range
recent_records = sdk.get_records(
    start_date="2023-01-01",
    end_date="2023-12-31"
)

# Pagination
paginated_records = sdk.get_records(
    cursor="cursor_from_previous_response",
    limit=10
)

Get Customer Records

Retrieve records for specific customers.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Get records for a specific customer
customer_records = sdk.get_customer_records(
    customer_email="customer@example.com"
)

# Filter customer records by type
customer_tree_records = sdk.get_customer_records(
    customer_email="customer@example.com",
    filter_by="tree_planted"
)

Get Customers

Retrieve customer information.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Get all customers (default limit is 10)
customers = sdk.get_customers()

# Get customers with filtering and pagination
filtered_customers = sdk.get_customers(
    customer_email="example@email.com",  # Optional: Filter by email
    limit=50,  # Optional: Limit results (1-1000)
    cursor="cursor_from_previous_response"  # Optional: For pagination
)

🔍 Track Impact

Track the complete lifecycle and current status of a specific impact, including project location, assigned agents, completion status, and documentation.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# First create an impact
response = sdk.plant_tree(amount=1)

# Then track its progress
tracking_info = sdk.track(
    user_id=response.user_id,
    time_utc=response.time_utc
)

print(f"Tracking ID: {tracking_info.tracking_id}")
print(f"Impact Initiated: {tracking_info.impact_initiated}")
if tracking_info.project_location:
    print(f"Project Location: {tracking_info.project_location}")
if tracking_info.assigned_agent:
    print(f"Assigned Agent: {tracking_info.assigned_agent}")
if tracking_info.impact_completed:
    print(f"Impact Completed: {tracking_info.impact_completed}")

You can also track impacts from historical records:

# Get records and track a specific impact
records = sdk.get_records(limit=1)
if records.user_records:
    record = records.user_records[0]
    tracking_info = sdk.track(
        user_id=record.user_id,
        time_utc=record.time_utc
    )
    print("Tracking Info:", tracking_info)

Track Response Fields:

  • tracking_id: Unique identifier for this impact (format: user_id-time_utc)
  • impact_initiated: UTC timestamp when the impact was created
  • tree_planted, waste_removed, carbon_captured, money_donated: Impact metrics (optional)
  • category: Impact category (e.g., "food" for food-bearing trees)
  • donation_available: When the donation became available for the project
  • donation_sent: When the donation was sent to the non-profit
  • assigned_agent: Name of the agent or organization executing the impact
  • project_location: Detailed description of project location and partners
  • location_map: Google Maps embed URL for the project location
  • impact_completed: When the impact was completed
  • donation_category: Type of impact funded (for donations)
  • impact_video: URL to video recording or live session
  • live_session_date: Scheduled live session timestamp
  • is_test_transaction: Whether this was a test transaction
  • is_bonus_impact: Whether this was a bonus impact from subscription plans

Get Impact

Get aggregated impact statistics.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Get overall impact statistics for your organization
impact = sdk.get_impact()

print(f"Trees planted: {impact.tree_planted}")
print(f"Ocean waste removed: {impact.waste_removed} lbs")
print(f"Carbon captured: {impact.carbon_captured} lbs")
print(f"Money donated: ${impact.money_donated / 100}")

Who Am I

Verify your API key and get account information.

from makeimpact import OneClickImpact

sdk = OneClickImpact("your_api_key")

# Verify API key and get account information
account_info = sdk.who_am_i()

⚙️ Configuration

Environments

The SDK supports two environments:

  • Production (default): Uses the live API at https://api.1clickimpact.com
  • Sandbox: Uses the testing API at https://sandbox.1clickimpact.com

To use the sandbox environment for testing:

from makeimpact import OneClickImpact, Environment

# Initialize with sandbox environment
sdk = OneClickImpact("your_test_api_key", Environment.SANDBOX)

🔗 Additional Resources

📄 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

makeimpact-1.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

makeimpact-1.2.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file makeimpact-1.2.0.tar.gz.

File metadata

  • Download URL: makeimpact-1.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for makeimpact-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3bea526e2517265ce2229dc3efce8adad7033f72bf7fec8c9f27f3a1d06dfe6b
MD5 4057ffcfb7ca42806a24fb1d956f2a07
BLAKE2b-256 0a916527b2102a8412a76ff972700f5c96448084b9a82c735b7c9b3a17fd7d5a

See more details on using hashes here.

File details

Details for the file makeimpact-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: makeimpact-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for makeimpact-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e0c04c3c4b8935e62f2891ca218dce88febd87014898b8eca4adf46bdd45c77
MD5 c527a0522461feef389203080c502d29
BLAKE2b-256 ec15728c4880f4a8701762139126c001452f8f5468d4319ec3782caf7e586068

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