Metadata-Version: 2.4
Name: hexagon-sdk
Version: 1.0.0
Summary: Make your website AI-readable by ChatGPT, Perplexity, Claude and other AI platforms
Home-page: https://github.com/hexagon-labs/hexagon-python-sdk
Author: Hexagon Labs
Author-email: hello@joinhexagon.com
Keywords: ai gpt chatgpt claude perplexity seo ai-search crawler bot
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Framework :: Flask
Classifier: Framework :: Django
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Provides-Extra: flask
Requires-Dist: flask>=2.0.0; extra == "flask"
Provides-Extra: django
Requires-Dist: django>=3.2.0; extra == "django"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Hexagon Python SDK

Make your website AI-readable by ChatGPT, Perplexity, Claude, and other AI platforms.

## Installation

```bash
pip install hexagon-sdk
```

## Quick Start

### Flask

```python
from flask import Flask, render_template
from hexagon import Hexagon

app = Flask(__name__)
hexagon = Hexagon(
    merchant_id='your-merchant-id',
    api_key='your-api-key'
)

@app.route('/')
@hexagon.enhance  # Automatically enhances for AI crawlers
def home():
    return render_template('index.html')

# Blog routes (auto-generated by Hexagon)
@app.route('/blog')
def blog_list():
    blogs = hexagon.get_blogs(page=1, limit=20)
    return render_template('blog_list.html', blogs=blogs['blogs'])

@app.route('/blog/<slug>')
def blog_detail(slug):
    blog = hexagon.get_blog(slug)
    if not blog:
        return "Blog not found", 404
    return render_template('blog_detail.html', blog=blog)

if __name__ == '__main__':
    app.run()
```

### Django

Add to your `settings.py`:

```python
# settings.py
MIDDLEWARE = [
    ...
    'hexagon.DjangoMiddleware',  # Add Hexagon middleware
    ...
]

HEXAGON_MERCHANT_ID = 'your-merchant-id'
HEXAGON_API_KEY = 'your-api-key'
```

That's it! All your Django views will now be enhanced for AI crawlers.

## What You Get

✅ ChatGPT finds your content instantly  
✅ Auto-generate 100+ blogs/day  
✅ Track AI bot visits  
✅ Content stays on your domain

## Features

### 1. AI-Optimized HTML

The SDK automatically enhances your HTML for AI crawlers by:
- Adding structured data (Schema.org)
- Converting content to markdown
- Injecting AI-friendly metadata
- Optimizing for search engines

### 2. Blog Management

Hexagon automatically generates SEO-optimized blogs for your products:

```python
# Get all blogs
blogs = hexagon.get_blogs(page=1, limit=20)

# Get single blog
blog = hexagon.get_blog('wireless-headphones-guide')
```

### 3. Smart Caching

Enhanced HTML is cached automatically for fast performance. Only the first AI crawler request has a small delay.

## Manual Enhancement

If you want more control, you can manually enhance HTML:

```python
from hexagon import Hexagon

hexagon = Hexagon(merchant_id='xxx', api_key='xxx')

# Enhance HTML manually
html = "<html><body>Hello World</body></html>"
enhanced = hexagon.enhance_html(
    html=html,
    url="https://example.com",
    user_agent="GPTBot"
)
```

## Configuration

```python
hexagon = Hexagon(
    merchant_id='your-merchant-id',  # Required
    api_key='your-api-key',          # Required
    api_url='https://joinhexagon.com/api/v1',  # Optional
    debug=False                       # Optional: enable debug logging
)
```

## Requirements

- Python 3.7+
- requests

## Support

Need help? Email us at [hello@joinhexagon.com](mailto:hello@joinhexagon.com)

## License

MIT

