Metadata-Version: 2.4
Name: me-qr
Version: 1.0.0
Summary: Official Python SDK for the ME-QR API
Author-email: ME-QR <info@me-qr.com>
License: MIT
Project-URL: Homepage, https://me-qr.com
Project-URL: Documentation, https://me-qr.com/api/doc
Project-URL: Repository, https://github.com/me-qr/me-qr-python-sdk
Project-URL: Issues, https://github.com/me-qr/me-qr-python-sdk/issues
Keywords: qr,qr-code,me-qr,api,sdk
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: httpx
Requires-Dist: httpx>=0.24; extra == "httpx"

# ME-QR Python SDK

Official Python client for the [ME-QR API](https://me-qr.com/api/doc).

## Requirements

- Python 3.9+
- `httpx` (optional, recommended) or standard `urllib`

## Installation

```bash
pip install me-qr
# with faster HTTP client (recommended):
pip install "me-qr[httpx]"
```

Or copy `me_qr.py` directly into your project.

## Quick Start

```python
from me_qr import MEQRClient

client = MEQRClient(token="YOUR_API_TOKEN")

# URL QR code → save to file
result = client.create_link("https://me-qr.com")
result.save("qr.png")

# Get as data URL for web embedding
print(result.to_data_url())  # data:image/png;base64,...
```

## Usage

### Run the example

```bash
python example.py
```

### URL QR code

```python
result = client.create_link("https://example.com")
result.save("link.png")
```

### Styled QR code

```python
from me_qr import QROptions

options = QROptions(
    size=600,
    foreground_color="#2563eb",
    background_color="#f8fafc",
    error_correction="H",
)
result = client.create_link("https://me-qr.com", format="svg", options=options)
result.save("styled.svg")
```

### Wi-Fi QR code

```python
from me_qr import WIFI_ENC_WPA  # 'wpa/wpa2'

result = client.create_wifi(
    ssid="MyNetwork",
    password="secret",
    encryption=WIFI_ENC_WPA,  # 'wpa/wpa2' | 'wpa3' | 'wep' | 'none' | 'raw'
)
result.save("wifi.png")
```

### vCard QR code

```python
result = client.create_vcard(
    name="Alex",
    last_name="Smith",
    phones=[{"phone": "+1234567890", "type": 0}],  # type: 0=general, 1=work
    emails=[{"email": "alex@example.com", "type": 0}],  # type: 0=general, 1=corporate
    organization="ACME Corp",
)
result.save("vcard.png")
```

### Email QR code

```python
result = client.create_email(
    email="support@example.com",
    subject="Hello",
    body="Message body",
)
result.save("email.png")
```

### Plain text QR code

```python
result = client.create_text("Hello, World!")
result.save("text.png")
```

### Full control (`create`)

```python
from me_qr import QRType

result = client.create(
    qr_type=QRType.WIFI,
    title="Office Wi-Fi",
    qr_fields_data={"ssid": "Corp", "password": "pass", "encryption": "wpa/wpa2"},
    format="svg",
)
```

## QR Type IDs (`QRType` enum)

| Value             | ID | Description       |
|-------------------|----|-------------------|
| `QRType.LINK`     | 1  | URL / website     |
| `QRType.PDF`      | 4  | PDF document      |
| `QRType.EMAIL`    | 5  | Email             |
| `QRType.VCARD`    | 7  | Contact card      |
| `QRType.APP_STORE`| 8  | App Store / Play  |
| `QRType.WHATSAPP` | 9  | WhatsApp          |
| `QRType.AUDIO`    | 10 | Audio file        |
| `QRType.MAP`      | 11 | GPS location      |
| `QRType.TEXT`     | 15 | Plain text        |
| `QRType.IMAGE`    | 16 | Image gallery     |
| `QRType.WIFI`     | 17 | Wi-Fi credentials |
| `QRType.PHONE`    | 27 | Phone call        |
| `QRType.SMS`      | 28 | SMS               |
| `QRType.VIDEO`    | 29 | Video             |

## Error Handling

```python
from me_qr import MEQRError

try:
    result = client.create_link("https://example.com")
except MEQRError as e:
    print(f"Error {e.status_code}: {e}")
    print(e.response)
```

## Output Formats

| Format | Use case                          |
|--------|-----------------------------------|
| `png`  | Print, web, general use           |
| `jpeg` | Smaller file size                 |
| `svg`  | High-resolution / infinite scale  |
| `json` | Raw QR matrix data                |

---

## Links

- 🌐 **Website**: [me-qr.com](https://me-qr.com)
- 📖 **API Docs**: [me-qr.com/api/doc](https://me-qr.com/api/doc)
- 💰 **Pricing**: [me-qr.com/pricing](https://me-qr.com/pricing)
- 🐛 **Issues**: [GitHub Issues](https://github.com/me-qr/me-qr-python-sdk/issues)
- 🐍 **PyPI**: [pypi.org/project/me-qr](https://pypi.org/project/me-qr/)

---

## License

MIT © [ME-QR](https://me-qr.com)
