Metadata-Version: 2.4
Name: redirox
Version: 0.1.0
Summary: Official Python SDK for Redirox URL shortener
Author: Kishore
License: MIT
Project-URL: Homepage, https://redirox.vercel.app
Project-URL: Repository, https://github.com/MKishoreDev/redirox-sdk
Keywords: url-shortener,redirox,shortener,qr-code
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

<p align="center">
  <img src="banner-rediox.png" alt="Redirox Banner">
</p>

<h1 align="center">Redirox</h1>

<h3 align="center">
🚀 Smart Links. Clean Routes.
</h3>

<p align="center">
  Modern Python SDK for the Redirox URL Shortener
</p>

<p align="center">
  <a href="https://pypi.org/project/redirox/">
    <img src="https://img.shields.io/pypi/v/redirox?style=for-the-badge&color=7c3aed" alt="PyPI">
  </a>

  <a href="https://pypi.org/project/redirox/">
    <img src="https://img.shields.io/pypi/pyversions/redirox?style=for-the-badge&color=2563eb" alt="Python Versions">
  </a>

  <a href="https://github.com/MKishoreDev/redirox-pypi/blob/main/LICENSE">
    <img src="https://img.shields.io/github/license/MKishoreDev/redirox-pypi?style=for-the-badge&color=111827" alt="License">
  </a>
</p>

<p align="center">
  <a href="https://redirox.vercel.app">
    <img src="https://img.shields.io/badge/Website-Redirox-111827?style=flat-square&logo=vercel">
  </a>

  <a href="https://github.com/MKishoreDev/redirox-pypi">
    <img src="https://img.shields.io/badge/GitHub-redirox--pypi-111827?style=flat-square&logo=github">
  </a>

  <img src="https://img.shields.io/badge/Made%20With-Python-7c3aed?style=flat-square&logo=python">
</p>

---

# 🌌 About

Redirox is a lightweight and modern URL shortener built for developers.

I always wondered:

> “Can a URL shortener be both powerful and minimal?”

So I built Redirox with one goal:

- ⚡ Fast
- 🎯 Minimal
- 🔒 Secure
- 🧩 Developer friendly

The platform is live at:

🔗 https://redirox.vercel.app

After building the platform, I decided to create an official PyPI package so developers can integrate Redirox directly into Python applications, scripts, automation workflows, and Telegram bots.

---

# ✨ Features

- 🔗 Smart URL shortening
- 🔒 Password protected links
- ⏳ Expiration support
- 📱 QR code generation
- ⚡ Fast redirects
- 🪶 Lightweight SDK
- 🐍 Pythonic API
- 🤖 Telegram bot support using Pyrogram
- 🌐 Clean developer experience

---

# 📦 Installation

## Basic Installation

```bash
pip install redirox
```

---

## Install with Telegram Bot Support

```bash
pip install pyrogram tgcrypto
```

---

# ⚡ Quick Start

```python
from redirox import Redirox

client = Redirox()

result = client.shorten(
    "https://google.com"
)

print(result)
```

---

# 🔗 Shorten URLs

```python
from redirox import Redirox

client = Redirox()

result = client.shorten(
    "https://example.com"
)

print("Short URL:", result["short_url"])
```

---

# 🔒 Password Protected Links

```python
from redirox import Redirox

client = Redirox()

result = client.shorten(
    "https://example.com",
    password="mypassword"
)

print(result)
```

---

# ⏳ Expiring Links

```python
from redirox import Redirox
from datetime import datetime, timedelta

client = Redirox()

expires_at = (
    datetime.utcnow() + timedelta(hours=1)
).isoformat()

result = client.shorten(
    "https://example.com",
    expires_at=expires_at
)

print(result["expires_at"])
```

---

# 📱 Generate QR Codes

```python
from redirox import Redirox

client = Redirox()

result = client.shorten(
    "https://github.com",
    generate_qr=True
)

print(result["qr_code"])
```

---

# 💾 Save QR Code as PNG

```python
import base64

qr_data = result["qr_code"].split(",")[1]

with open("qr.png", "wb") as f:
    f.write(base64.b64decode(qr_data))

print("QR Code saved!")
```

---

# 📊 Get Link Information

```python
from redirox import Redirox

client = Redirox()

info = client.info("abc123")

print(info)
```

---

# 🤖 Telegram Bot Example (Pyrogram)

```python
import base64

from pyrogram import Client, filters
from redirox import Redirox

app = Client(
    "redirox-bot",
    api_id=12345,
    api_hash="YOUR_API_HASH",
    bot_token="YOUR_BOT_TOKEN"
)

redirox = Redirox()


@app.on_message(filters.text & filters.private)
async def shorten_link(client, message):
    url = message.text.strip()

    try:
        result = redirox.shorten(
            url,
            generate_qr=True
        )

        short_url = result["short_url"]
        qr_code = result["qr_code"]

        # Decode QR Code
        qr_data = qr_code.split(",")[1]

        with open("qr.png", "wb") as f:
            f.write(base64.b64decode(qr_data))

        # Send QR Code Image
        await message.reply_photo(
            photo="qr.png",
            caption=(
                f"🔗 **Short URL:**\n"
                f"{short_url}"
            )
        )

    except Exception as e:
        await message.reply_text(
            f"❌ Error:\n{e}"
        )


app.run()
```

---

# 📩 Example Telegram Bot Response

The Telegram bot will:

- 🔗 Shorten the URL
- 📱 Generate a QR code
- 🖼 Send the QR code as an image
- ⚡ Return the shortened link instantly

Perfect for:

- Telegram utility bots
- Channel management tools
- Automation workflows
- Link sharing bots

---

# 📄 Example Response

```python
{
    "code": "abc123",
    "short_url": "https://redirox.vercel.app/abc123",
    "url": "https://google.com",
    "qr_code": None,
    "expires_at": None,
    "has_password": False
}
```

---

# 🎯 Philosophy

Redirox focuses on simplicity.

No bloated dashboards.  
No forced signups.  
No unnecessary friction.

Just fast redirects, clean APIs, and developer-first workflows.

---

# 🌍 Open Source

Contributions are welcome!

You can help by:

- Fixing bugs
- Improving documentation
- Suggesting features
- Enhancing the SDK
- Creating integrations

Feel free to open issues or submit pull requests.

---

# 🔗 Links

| Platform | Link |
|---|---|
| 🌐 Website | https://redirox.vercel.app |
| 📦 PyPI | https://pypi.org/project/redirox/ |
| 💻 GitHub | https://github.com/MKishoreDev/redirox-pypi |

---

# 📄 License

MIT License © Kishore

---

<p align="center">
  <img src="https://img.shields.io/badge/Built%20with-Passion-7c3aed?style=for-the-badge">
</p>

<p align="center">
  ❤️ Made with passion by Kishore
</p>
