Catalog PyPI
Back to packageRELEASE DETAILS

1.0.0

PyPI

adsoverai

Python SDK for AdsOverAI - Native advertising for AI chat interfaces

adsadvertisingaichatconversational-aimonetization
Published27 Oct 2025
Direct dependencies7
Transitive dependenciesNot calculated

README

Version 1.0.0 documentation

Python SDK for AdsOverAI - Native advertising for AI chat interfaces

PyPI version Python Support License: MIT

Features

  • 🎯 Context-Aware Ads - Display relevant ads based on AI conversation context
  • ⚡ Fast & Lightweight - Optimized for performance with built-in caching
  • 🔒 Type Safe - Full type hints and validation
  • 🛡️ Error Handling - Comprehensive exception handling
  • 🌙 Theme Support - Light, dark, and auto theme modes
  • 📝 Logging - Debug mode with detailed logging

Installation

pip install adsoverai

Quick Start

from adsoverai import AdsOverAI

# Initialize the client
client = AdsOverAI(
    api_key="your-api-key",
    max_ads=3,
    theme="auto"
)

# Fetch ads based on conversation context
ads = client.get_ads(
    query="What are the best running shoes?",
    response="Here are some great running shoe options..."
)

# Display ads
for ad in ads:
    print(f"Title: {ad.title}")
    print(f"Description: {ad.description}")
    print(f"URL: {ad.url}")
    print("---")

Convenience Function

from adsoverai import get_ads

ads = get_ads(
    api_key="your-api-key",
    query="best headphones",
    response="Here are top-rated headphones...",
    max_ads=2
)

API Reference

AdsOverAI

Main client class for the SDK.

Parameters

  • api_key (str, required): Your AdsOverAI API key
  • max_ads (int, default=3): Maximum number of ads to return (1-10)
  • theme (str, default="auto"): Theme preference ("light", "dark", "auto")
  • api_url (str): API endpoint URL
  • debug_mode (bool, default=False): Enable debug logging
  • timeout (int, default=10): Request timeout in seconds
  • cache_ttl (int, default=300): Cache time-to-live in seconds

Methods

get_ads(query, response, max_ads=None, use_cache=True)

Fetch contextual ads based on conversation.

clear_cache()

Clear all cached results.

update_config(max_ads=None, theme=None, debug_mode=None)

Update client configuration.

close()

Close the session and cleanup resources.

AdResult

Data class representing an ad result.

Attributes

  • title (str): Ad title
  • description (str): Ad description
  • url (str): Ad URL
  • image_url (str, optional): Ad image URL
  • advertiser (str, optional): Advertiser name
  • cta_text (str): Call-to-action text
  • metadata (dict): Additional metadata

Advanced Usage

Context Manager

with AdsOverAI(api_key="your-key") as client:
    ads = client.get_ads(query="...", response="...")
    for ad in ads:
        print(ad.title)
# Session automatically closed

Error Handling

from adsoverai import AdsOverAI, AuthenticationError, APIError

try:
    client = AdsOverAI(api_key="your-key")
    ads = client.get_ads(query="...", response="...")
except AuthenticationError:
    print("Invalid API key")
except APIError as e:
    print(f"API error: {e}")

Debug Mode

client = AdsOverAI(
    api_key="your-key",
    debug_mode=True  # Enable detailed logging
)

Cache Control

# Disable cache for a specific request
ads = client.get_ads(
    query="...",
    response="...",
    use_cache=False
)

# Clear all cached results
client.clear_cache()

Examples

See the examples/ directory for more usage examples:

  • basic_usage.py - Simple usage example
  • advanced_usage.py - Advanced features
  • django_integration.py - Django integration example

Development

Setup

git clone https://github.com/adsoverai/python-sdk.git
cd python-sdk
pip install -e ".[dev]"

Run Tests

pytest

Code Formatting

black adsoverai/ tests/
flake8 adsoverai/ tests/
mypy adsoverai/

Support

License

MIT © AdsOverAI Team

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 7

Native requirements
7 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
requests>=2.28.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "dev"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov>=4.0.0; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=22.0.0; extra == "dev"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
flake8>=5.0.0; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mypy>=0.990; extra == "dev"runtime
types-requests
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
types-requests; extra == "dev"runtime

Distribution files

2 collected
adsoverai-1.0.0-py3-none-any.whl

bdist_wheel · 3.89 KB · Python py3

Source file
adsoverai-1.0.0.tar.gz

sdist · 12.88 KB · Python source

Source file

Repository

PENDING
adsoverai/python-sdk

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:54 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:1e7d5d0955afa5f93c444fd4e3c069d334fb14e7f2ecb3979329fa666dd66d7c

Other collected versions

View all collected versions →