Metadata-Version: 2.4
Name: brsx-qrx
Version: 0.1.0
Summary: Python client and CLI for BRSX Qrx QR code generation
Author-email: BRSX Labs <support@brsxlabs.com>
License: MIT
Project-URL: Homepage, https://qrx.brsxlabs.com
Project-URL: Documentation, https://help.brsxlabs.com
Keywords: brsx,qrx,qr,qrcode,barcode
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# brsx-qrx

Python client and command-line tool for [BRSX Qrx](https://qrx.brsxlabs.com) QR code generation.
No dependencies beyond the standard library.

```bash
pip install brsx-qrx
```

## Get an API key

Sign in to [qrx.brsxlabs.com](https://qrx.brsxlabs.com), click your name at the top right,
open **API keys** and create one. The key starts with `brsxq_` and is shown only once.

```bash
export BRSX_QRX_KEY=brsxq_...
```

Every QR code you generate counts against your daily quota.

## Python

```python
from brsx_qrx import Qrx

qrx = Qrx()                                   # reads BRSX_QRX_KEY

qrx.create("https://brsxlabs.com", path="site.png")     # writes the file
png = qrx.create("hello", size=600)                     # or get the bytes

print(qrx.read("site.png"))                             # https://brsxlabs.com

u = qrx.usage()
print(u.plan, u.remaining, "of", u.daily_limit)
```

### Typed QR codes

`types()` lists what the server supports; each type takes its own fields.

```python
print(qrx.types())                            # {'text': 'Metin', 'url': ...}

qrx.create_typed("wifi", {"ssid": "BRSX", "password": "1234", "encryption": "WPA"},
                 path="wifi.png")
```

### Encrypted content

```python
qrx.create_typed("text", {"text": "secret"}, path="s.png", password="abc")

r = qrx.read("s.png")
print(r.encrypted, r.content)                 # True None

print(qrx.read("s.png", password="abc").content)   # secret
```

### Errors

| Exception | When |
|---|---|
| `AuthError` | Missing, invalid or revoked API key |
| `QuotaError` | Daily quota used up, or content too long |
| `QrxError` | Any other API error (base class) |

## Command line

```bash
brsx-qrx usage
brsx-qrx types
brsx-qrx create "https://brsxlabs.com" -o site.png
brsx-qrx create "secret" -o s.png --password abc
brsx-qrx create -o wifi.png --type wifi --field ssid=BRSX --field password=1234
brsx-qrx read site.png
brsx-qrx read s.png --password abc
```

With no `-o`, the PNG goes to stdout:

```bash
brsx-qrx create "https://brsxlabs.com" > qr.png
```

## HTTP API

All endpoints take `Authorization: Bearer brsxq_...`.

| Method | Path | |
|---|---|---|
| GET | `/api/v1/me` | plan and remaining daily quota |
| GET | `/api/v1/types` | supported QR types |
| GET | `/api/v1/qr?data=...&size=400` | PNG for plain text or a URL |
| POST | `/api/v1/qr` | PNG for `{type, fields, size, password?}` |
| POST | `/api/v1/read` | read a QR image (multipart `image`, optional `password`) |

## License

MIT
