Skip to main content

Getting Started with Python

Safe API Key Storage

In a production setup, do not store API Keys in the host's environment variables or in the source code.

Requirements

  • Requires Python v3.8 or later.

Install the Opportify SDK

Install Using a Package Manager

To start using the Opportify SDK in your Python project, you can install the Opportify SDK from the PyPI package manager:

pip install opportify-sdk

Usage

Client

After you installed the library, you can create a client instance and interface with it.

from opportify_sdk import EmailInsights

# Initialize the wrapper with your API key
api_key = "<YOUR-API-KEY-HERE>"
email_insights = EmailInsights(api_key)

# Optional: Configure host, version, and debug mode
email_insights.set_version("v1")

Make a request

from opportify_sdk import EmailInsights

# Initialize the wrapper with your API key
api_key = "<YOUR-API-KEY-HERE>"
email_insights = EmailInsights(api_key)

# Optional: Configure host, version, and debug mode
email_insights.set_version("v1")

# Define request parameters
params = {
"email": "<SOME-EMAIL-HERE>",
"enableAutoCorrection": True,
"enableAi": True
}

# Call the API
try:
result = email_insights.analyze(params)
print("Response:", result)
except Exception as e:
print(f"Error: {e}")

What's next?

How-To Guides

Once you have installed the Opportify SDK, you can start building your application. You can find usage examples in this Wiki's how-to guides.