# Opportify-SDK-Python
## Overview
The **Opportify Insights API** provides access to a powerful and up-to-date platform. With advanced data warehousing and AI-driven capabilities, this API is designed to empower your business to make informed, data-driven decisions and effectively assess potential risks.
[Sign Up Free](https://www.opportify.ai)
### Base URL
Use the following base URL for all API requests:
```plaintext
https://api.opportify.ai/insights/v1/<service>/<endpoint>
```
## Requirements
Requires Python v3.8 or later
## Getting Started
First, install Opportify SDK via PyPI manager:
```
pip install opportify-sdk
```
## Single Analysis
### Calling Email Insights
```python
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}")
```
### Calling IP Insights
```python
from opportify_sdk import IpInsights
# Initialize the wrapper with your API key
api_key = "<YOUR-API-KEY-HERE>"
ip_insights = IpInsights(api_key)
# Optional: Configure host, version, and debug mode
ip_insights.set_version("v1")
# Define request parameters
params = {
"ip": "<SOME-IP-HERE>",
"enableAi": True
}
# Call the API
try:
result = ip_insights.analyze(params)
print("Response:", result)
except Exception as e:
print(f"Error: {e}")
```
## Batch Analysis
For processing large volumes of emails or IP addresses, use the batch analysis methods:
### Batch Email Analysis
```python
from opportify_sdk import EmailInsights
# Initialize the wrapper with your API key
api_key = "<YOUR-API-KEY-HERE>"
email_insights = EmailInsights(api_key)
# Define batch request parameters
batch_params = {
"emails": [
"user1@company.com",
"user2@domain.org",
"test@example.com"
],
"enableAutoCorrection": True,
"enableAi": True
}
# Start batch analysis
try:
batch_response = email_insights.batch_analyze(batch_params)
job_id = batch_response['job_id']
print(f"Batch job started: {job_id}")
# Check batch status
status = email_insights.get_batch_status(job_id)
print(f"Status: {status['status']}, Progress: {status['progress']}%")
# When completed, download URLs will be available
if status['status'] == 'COMPLETED':
download_urls = status['download_urls']
print(f"Results ready: {download_urls['csv']}")
except Exception as e:
print(f"Error: {e}")
```
### Batch IP Analysis
```python
from opportify_sdk import IpInsights
# Initialize the wrapper with your API key
api_key = "<YOUR-API-KEY-HERE>"
ip_insights = IpInsights(api_key)
# Define batch request parameters
batch_params = {
"ips": [
"8.8.8.8",
"1.1.1.1",
"192.168.1.1"
],
"enableAi": True
}
# Start batch analysis
try:
batch_response = ip_insights.batch_analyze(batch_params)
job_id = batch_response['job_id']
print(f"Batch job started: {job_id}")
# Check batch status
status = ip_insights.get_batch_status(job_id)
print(f"Status: {status['status']}, Progress: {status['progress']}%")
# When completed, download URLs will be available
if status['status'] == 'COMPLETED':
download_urls = status['download_urls']
print(f"Results ready: {download_urls['csv']}")
except Exception as e:
print(f"Error: {e}")
```
## Configuration
### Enable Debug Mode
```python
ip_insights.set_version("v1").set_debug_mode(True)
email_insights.set_version("v1").set_debug_mode(True)
```
### Batch Status Polling
For long-running batch jobs, poll the status periodically:
```python
import time
def wait_for_batch_completion(client, job_id, max_wait=300):
"""Wait for batch job to complete with polling."""
start_time = time.time()
while time.time() - start_time < max_wait:
status = client.get_batch_status(job_id)
if status['status'] == 'COMPLETED':
return status
elif status['status'] == 'ERROR':
raise Exception(f"Batch job failed: {status.get('status_description')}")
print(f"Progress: {status.get('progress', 0)}%")
time.sleep(10) # Wait 10 seconds before next check
raise TimeoutError("Batch job did not complete within the timeout period")
# Usage
try:
batch_response = email_insights.batch_analyze(batch_params)
final_status = wait_for_batch_completion(email_insights, batch_response['job_id'])
print("Batch completed successfully!")
except Exception as e:
print(f"Error: {e}")
```
## About this package
This Python package supports both single and batch analysis operations and is a customization of the base generated by:
- [OpenAPI Generator](https://openapi-generator.tech) project.
## Additional Resources
- **[Batch Processing Guide](BATCH_PROCESSING_GUIDE.md)** - Comprehensive guide for batch operations
- **[API Documentation](https://api.opportify.ai/docs)** - Full API reference
- **[Support](https://www.opportify.ai/support)** - Get help and support
Raw data
{
"_id": null,
"home_page": "https://github.com/opportify/opportify-sdk-python",
"name": "opportify-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "OpenAPI, OpenAPI-Generator, Opportify Insights API, Opportify",
"author": "Opportify & OpenAPI-Generator",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ab/fa/63ab76ae7ed6788b419632728a0d4b114225fc7366ae1409d0464e55c241/opportify_sdk-0.2.0.tar.gz",
"platform": null,
"description": "# Opportify-SDK-Python\n\n## Overview\n\nThe **Opportify Insights API** provides access to a powerful and up-to-date platform. With advanced data warehousing and AI-driven capabilities, this API is designed to empower your business to make informed, data-driven decisions and effectively assess potential risks.\n\n[Sign Up Free](https://www.opportify.ai)\n\n### Base URL\nUse the following base URL for all API requests:\n\n```plaintext\nhttps://api.opportify.ai/insights/v1/<service>/<endpoint>\n```\n\n## Requirements\n\nRequires Python v3.8 or later\n\n## Getting Started\n\nFirst, install Opportify SDK via PyPI manager:\n\n```\npip install opportify-sdk\n```\n\n## Single Analysis\n\n### Calling Email Insights\n\n```python\nfrom opportify_sdk import EmailInsights\n\n# Initialize the wrapper with your API key\napi_key = \"<YOUR-API-KEY-HERE>\"\nemail_insights = EmailInsights(api_key)\n\n# Optional: Configure host, version, and debug mode\nemail_insights.set_version(\"v1\")\n\n# Define request parameters\nparams = {\n \"email\": \"<SOME-EMAIL-HERE>\",\n \"enableAutoCorrection\": True,\n \"enableAi\": True \n}\n\n# Call the API\ntry:\n result = email_insights.analyze(params)\n print(\"Response:\", result)\nexcept Exception as e:\n print(f\"Error: {e}\")\n```\n\n### Calling IP Insights\n\n```python\n\nfrom opportify_sdk import IpInsights\n\n# Initialize the wrapper with your API key\napi_key = \"<YOUR-API-KEY-HERE>\"\nip_insights = IpInsights(api_key)\n\n# Optional: Configure host, version, and debug mode\nip_insights.set_version(\"v1\")\n\n# Define request parameters\nparams = {\n \"ip\": \"<SOME-IP-HERE>\",\n \"enableAi\": True \n}\n\n# Call the API\ntry:\n result = ip_insights.analyze(params)\n print(\"Response:\", result)\nexcept Exception as e:\n print(f\"Error: {e}\")\n```\n\n## Batch Analysis\n\nFor processing large volumes of emails or IP addresses, use the batch analysis methods:\n\n### Batch Email Analysis\n\n```python\nfrom opportify_sdk import EmailInsights\n\n# Initialize the wrapper with your API key\napi_key = \"<YOUR-API-KEY-HERE>\"\nemail_insights = EmailInsights(api_key)\n\n# Define batch request parameters\nbatch_params = {\n \"emails\": [\n \"user1@company.com\",\n \"user2@domain.org\",\n \"test@example.com\"\n ],\n \"enableAutoCorrection\": True,\n \"enableAi\": True \n}\n\n# Start batch analysis\ntry:\n batch_response = email_insights.batch_analyze(batch_params)\n job_id = batch_response['job_id']\n print(f\"Batch job started: {job_id}\")\n \n # Check batch status\n status = email_insights.get_batch_status(job_id)\n print(f\"Status: {status['status']}, Progress: {status['progress']}%\")\n \n # When completed, download URLs will be available\n if status['status'] == 'COMPLETED':\n download_urls = status['download_urls']\n print(f\"Results ready: {download_urls['csv']}\")\n \nexcept Exception as e:\n print(f\"Error: {e}\")\n```\n\n### Batch IP Analysis\n\n```python\nfrom opportify_sdk import IpInsights\n\n# Initialize the wrapper with your API key\napi_key = \"<YOUR-API-KEY-HERE>\"\nip_insights = IpInsights(api_key)\n\n# Define batch request parameters\nbatch_params = {\n \"ips\": [\n \"8.8.8.8\",\n \"1.1.1.1\",\n \"192.168.1.1\"\n ],\n \"enableAi\": True \n}\n\n# Start batch analysis\ntry:\n batch_response = ip_insights.batch_analyze(batch_params)\n job_id = batch_response['job_id']\n print(f\"Batch job started: {job_id}\")\n \n # Check batch status\n status = ip_insights.get_batch_status(job_id)\n print(f\"Status: {status['status']}, Progress: {status['progress']}%\")\n \n # When completed, download URLs will be available\n if status['status'] == 'COMPLETED':\n download_urls = status['download_urls']\n print(f\"Results ready: {download_urls['csv']}\")\n \nexcept Exception as e:\n print(f\"Error: {e}\")\n```\n\n## Configuration\n\n### Enable Debug Mode\n\n```python\nip_insights.set_version(\"v1\").set_debug_mode(True)\nemail_insights.set_version(\"v1\").set_debug_mode(True)\n```\n\n### Batch Status Polling\n\nFor long-running batch jobs, poll the status periodically:\n\n```python\nimport time\n\ndef wait_for_batch_completion(client, job_id, max_wait=300):\n \"\"\"Wait for batch job to complete with polling.\"\"\"\n start_time = time.time()\n \n while time.time() - start_time < max_wait:\n status = client.get_batch_status(job_id)\n \n if status['status'] == 'COMPLETED':\n return status\n elif status['status'] == 'ERROR':\n raise Exception(f\"Batch job failed: {status.get('status_description')}\")\n \n print(f\"Progress: {status.get('progress', 0)}%\")\n time.sleep(10) # Wait 10 seconds before next check\n \n raise TimeoutError(\"Batch job did not complete within the timeout period\")\n\n# Usage\ntry:\n batch_response = email_insights.batch_analyze(batch_params)\n final_status = wait_for_batch_completion(email_insights, batch_response['job_id'])\n print(\"Batch completed successfully!\")\nexcept Exception as e:\n print(f\"Error: {e}\")\n```\n\n## About this package\n\nThis Python package supports both single and batch analysis operations and is a customization of the base generated by:\n\n- [OpenAPI Generator](https://openapi-generator.tech) project.\n\n## Additional Resources\n\n- **[Batch Processing Guide](BATCH_PROCESSING_GUIDE.md)** - Comprehensive guide for batch operations\n- **[API Documentation](https://api.opportify.ai/docs)** - Full API reference\n- **[Support](https://www.opportify.ai/support)** - Get help and support\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Opportify Insights API",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/opportify/opportify-sdk-python"
},
"split_keywords": [
"openapi",
" openapi-generator",
" opportify insights api",
" opportify"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1a8792ef85ba04af85e1b76ab2e3d3082fd2ab5210c8e872abe4156960737052",
"md5": "884383acb1d72490ab88c4f3ba0ccab7",
"sha256": "6d88bcc122a345eab649bcdc7bb5345812b7c7f88e9acc6b4d693ac6ef9a2234"
},
"downloads": -1,
"filename": "opportify_sdk-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "884383acb1d72490ab88c4f3ba0ccab7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 193123,
"upload_time": "2025-08-23T14:49:04",
"upload_time_iso_8601": "2025-08-23T14:49:04.272158Z",
"url": "https://files.pythonhosted.org/packages/1a/87/92ef85ba04af85e1b76ab2e3d3082fd2ab5210c8e872abe4156960737052/opportify_sdk-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "abfa63ab76ae7ed6788b419632728a0d4b114225fc7366ae1409d0464e55c241",
"md5": "4880fcef516858d3fff544a7623c174d",
"sha256": "2acfe75772cbc3ad10fb8c1b17ddcd56640046a0016343614af07391f6341125"
},
"downloads": -1,
"filename": "opportify_sdk-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "4880fcef516858d3fff544a7623c174d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 65842,
"upload_time": "2025-08-23T14:49:05",
"upload_time_iso_8601": "2025-08-23T14:49:05.482996Z",
"url": "https://files.pythonhosted.org/packages/ab/fa/63ab76ae7ed6788b419632728a0d4b114225fc7366ae1409d0464e55c241/opportify_sdk-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-23 14:49:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opportify",
"github_project": "opportify-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "urllib3",
"specs": [
[
">=",
"1.25.3"
],
[
"<",
"3.0.0"
]
]
},
{
"name": "python_dateutil",
"specs": [
[
">=",
"2.8.2"
]
]
},
{
"name": "pydantic",
"specs": [
[
">=",
"2"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.7.1"
]
]
}
],
"tox": true,
"lcname": "opportify-sdk"
}