Skip to main content

Python SDK for the Reddit Insights API

Project description

Reddit Insights Python SDK

Official Python SDK for the Reddit Insights API. Analyze Reddit conversations with AI-powered semantic search.

Installation

pip install reddit-insights

Quick Start

from reddit_insights import RedditInsightsClient

# Initialize the client
client = RedditInsightsClient(api_key="YOUR_API_KEY")

# Semantic search
results = client.semantic_search(
    query="What do young people complain about banking apps?",
    limit=20
)
print(results)

# Vector search with date filters
results = client.vector_search(
    query="electric vehicle charging",
    start_date="2025-01-01",
    end_date="2025-01-31",
    limit=30
)

# Get trending topics
trends = client.get_trends(
    start_date="2025-01-01",
    end_date="2025-01-31",
    limit=20
)

Sonar Management (FREE Endpoints)

Sonars allow you to monitor Reddit conversations and receive alerts.

# List all sonars
sonars = client.list_sonars()

# Create a new sonar
sonar = client.create_sonar(
    name="Product Feedback Monitor",
    query="What do users think about our product?",
    description="Track product feedback",
    schedule="daily",
    triggers={
        "keywords": ["bug", "issue", "problem"],
        "sentiment": "negative",
        "minNewPosts": 5
    },
    notify_email=True
)

# Get sonar execution history
executions = client.get_sonar_executions(
    sonar_id="sonar_123",
    limit=50
)

# Get detailed execution results
detail = client.get_execution_detail(execution_id="exec_789")

API Reference

RedditInsightsClient

Constructor

RedditInsightsClient(
    api_key: str,
    base_url: str = "https://reddit-insights.com",
    timeout: int = 30
)

Methods

Method Description Quota
semantic_search(query, limit) AI-powered semantic search Uses quota
vector_search(query, limit, start_date, end_date) Vector similarity search Uses quota
get_trends(start_date, end_date, limit) Get trending topics Uses quota
list_sonars() List all sonars FREE
create_sonar(...) Create a new sonar FREE
get_sonar_executions(sonar_id, limit, offset) Get execution history FREE
get_execution_detail(execution_id) Get execution details FREE

Error Handling

from reddit_insights import (
    RedditInsightsClient,
    AuthenticationError,
    RateLimitError,
    ValidationError,
    APIError
)

client = RedditInsightsClient(api_key="YOUR_API_KEY")

try:
    results = client.semantic_search(query="test query")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded")
except ValidationError as e:
    print(f"Invalid request: {e.message}")
except APIError as e:
    print(f"API error: {e.message}")

Rate Limits

Tier Limit
Free 100 requests/hour
Pro 10,000 requests/month
Enterprise Unlimited

License

MIT License

Support

For support, please visit https://reddit-insights.com or contact support@reddit-insights.com.

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

reddit_insights-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

reddit_insights-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file reddit_insights-1.0.0.tar.gz.

File metadata

  • Download URL: reddit_insights-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for reddit_insights-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c4fba46d59399891309bf9b189ca8786310db3ee52ed3cd58c2ae193375dbcda
MD5 26f30c098c6c5706f854a11c464449a2
BLAKE2b-256 755c9d0680ed770340d4d86a9dfc0478315b4ec8e645b101c1c85fe6685b784a

See more details on using hashes here.

File details

Details for the file reddit_insights-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for reddit_insights-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46c57e736602c840e22dcee7af7f01026405d94d23fab854fb63e1065c13102e
MD5 89747a2c788d3d907b83c97432cd076c
BLAKE2b-256 1352169572435b00a6c54b0597c7cf2299541fcf4608142bfc6ae895521973d5

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