Metadata-Version: 2.4
Name: sentrygram
Version: 0.1.0
Summary: Python SDK for Sentrygram - send alerts to your Telegram
Project-URL: Homepage, https://sentrygram.com
Project-URL: Documentation, https://github.com/tssandor/sentrygram-sdk-python
Project-URL: Repository, https://github.com/tssandor/sentrygram-sdk-python
Author-email: Sentrygram <hello@sentrygram.com>
License-Expression: MIT
License-File: LICENSE
Keywords: alerts,monitoring,notifications,sentrygram,telegram
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.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Requires-Dist: requests>=2.20.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# Sentrygram Python SDK

Send alerts to your Telegram with one line of code.

## Installation

```bash
pip install sentrygram
```

## Quick Start

```python
from sentrygram import Sentrygram

# Initialize with your API key
client = Sentrygram("sk_your_api_key")

# Send a simple alert
client.alert("Deployment completed successfully!")

# Send with severity level
client.alert("Database connection failed", level="error")

# Send with context
client.alert(
    "New user signup",
    level="info",
    context={"user_id": 123, "plan": "pro"}
)
```

## Alert Levels

- `info` - Informational messages (blue)
- `warning` - Warning messages (yellow)
- `error` - Error messages (red)
- `critical` - Critical alerts (red)

```python
from sentrygram import Sentrygram, AlertLevel

client = Sentrygram("sk_your_api_key")
client.alert("Server is down!", level=AlertLevel.CRITICAL)
```

## Error Handling

```python
from sentrygram import Sentrygram
from sentrygram.client import RateLimitError, NotificationsPausedError, SentrygramError

client = Sentrygram("sk_your_api_key")

try:
    client.alert("Hello!")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after} seconds")
except NotificationsPausedError:
    print("Notifications paused. Reactivate at sentrygram.com")
except SentrygramError as e:
    print(f"Error: {e}")
```

## Rate Limits

- **Burst limit**: 10 alerts per minute
- **Hourly limit**: 200 alerts per hour

If you exceed the burst limit repeatedly, notifications will be automatically paused to prevent spam.

## Get Your API Key

1. Sign up at [sentrygram.com](https://sentrygram.com)
2. Link your Telegram account
3. Create an API key in the dashboard

## License

MIT
