Metadata-Version: 2.2
Name: openrouter_exception_handler
Version: 0.4.2
Summary: Handler for exceptions in Python with OpenRouter.ai
Author-email: Dannybombastic <dannybombastic@example.com>
License: MIT
Project-URL: Homepage, https://github.com/dannybombastic/openrouter_exception_handler
Project-URL: Repository, https://github.com/dannybombastic/openrouter_exception_handler
Keywords: openrouter,exception,handler
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
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 :: Only
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests

# OpenRouter Exception Handler

A Python module distributed via pip that automatically handles exceptions using intelligent responses generated by OpenRouter.ai.

## 🚀 Installation

```bash
pip install openrouter-exception-handler
```

## 📌 Features

- Automatically captures Python exceptions during execution.
- Sends exception details to OpenRouter.ai.
- Displays intelligent responses from OpenRouter.ai directly in your stdout.
- Facilitates AI-assisted debugging, reducing the time needed for error diagnosis.

## 🔧 Quick Usage

Simply decorate your functions with `@exception_handler`:

```python
from openrouter_exception_handler.exception_handler import exception_handler

@exception_handler
def divide(a, b):
    return a / b

divide(10, 0)  # Will trigger ZeroDivisionError
```

### Example Output

```
❌ Exception captured:
Traceback (most recent call last):
  File "example.py", line 6, in wrapper
    return func(*args, **kwargs)
  File "example.py", line 10, in divide
    return a / b
ZeroDivisionError: division by zero

AI Response:
This exception occurs because you're trying to divide by zero. Validate your inputs before performing division to prevent this error.
```

## 🔑 Configuration

Define your OpenRouter.ai API key in the environment variable `APIKEY_OPENROUTER`:

```bash
export APIKEY_OPENROUTER="your_api_key_here"
```

## 📦 Installation

Install easily using pip:

```bash
pip install openrouter-exception-handler
```

## 📌 Requirements

- Python >= 3.6
- requests

## 📄 License

MIT



### Here's a simple guide to create an API key on OpenRouter:

Sign Up or Log In

Go to openrouter.ai and create an account, or log in if you already have one.
Go to Your User/Developer Settings

Look for a section like Developer Settings, API Keys, or Settings in your account dashboard.
Generate a New Key

Click Generate New Key (or a similar button) to create your new API key.
Copy the generated API key. Note that for security reasons, you usually only get to see the key once.
Save Your API Key

Store it in a safe place (e.g., an environment variable or a password manager).
Avoid committing it directly to a public repository or version control.
Tip: Once you have your API key, set it in your environment (e.g., OPENROUTER_API_KEY), so your application can access it securely without exposing it in the source code.
