Metadata-Version: 2.5
Name: stanzaapi-gs1-decoder
Version: 1.0.0
Summary: Official zero-dependency, high-speed Python client for GS1 Barcode & Digital Link Decoder
Project-URL: Homepage, https://stanzaapi.com/tools/gs1-decoder
Project-URL: Repository, https://github.com/StanzaAPI/gs1-decoder-python
Author: Stanza
License-Expression: MIT
Keywords: ai-identifier,barcode,datamatrix,digital-link,gs1,gs1-128,gtin,qr-code,sunrise-2027
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# GS1 Barcode & Digital Link Decoder — Python SDK

[![PyPI version](https://img.shields.io/pypi/v/stanzaapi-gs1-decoder.svg)](https://pypi.org/project/stanzaapi-gs1-decoder/)
[![Python Versions](https://img.shields.io/pypi/pyversions/stanzaapi-gs1-decoder.svg)](https://pypi.org/project/stanzaapi-gs1-decoder/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Stanza API](https://img.shields.io/badge/Powered%20by-Stanza-blue)](https://stanzaapi.com)

> Decode GS1 DataMatrix, GS1-128, FNC1 barcodes, and GS1 Digital Link URIs into structured JSON in sub-5ms.

Official, zero-dependency Python 3.8+ client library for **GS1 Barcode & Digital Link Decoder**, built on the [Stanza Micro-API Network](https://stanzaapi.com). Intended for enterprise data pipelines, backend verification, and sub-5ms edge compute.

* 🌐 **Live Web Playground:** [Test your inputs online](https://stanzaapi.com/tools/gs1-decoder)
* 📚 **API Documentation:** [View full schema on Stanza](https://stanzaapi.com/tools/gs1-decoder)
* ⚡ **Platform Overview:** [Explore the Stanza Developer Network](https://stanzaapi.com)

---

## 📦 Installation

```bash
pip install stanzaapi-gs1-decoder
```

---

## 🚀 Quickstart

```python
import os
from stanzaapi_gs1_decoder import Gs1DecoderClient

# Initialize client (api_key optional for local evaluation)
client = Gs1DecoderClient(
    api_key=os.getenv("STANZA_API_KEY")
)

# Execute deterministic validation
response = client.parse("(01)00123456789012(21)12345")

if response.get("success"):
    print("Verification Success:", response["data"])
else:
    print("Validation Error:", response.get("error"), response.get("code"))
```

---

## 📄 Example Response

```json
{
  "success": true,
  "data": {
    "gtin": "00123456789012",
    "serial_number": "12345",
    "ai_elements": [
      {
        "ai": "01",
        "label": "GTIN",
        "value": "00123456789012"
      },
      {
        "ai": "21",
        "label": "SERIAL",
        "value": "12345"
      }
    ]
  }
}
```

---

## ⚙️ Client Options

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `api_key` | `Optional[str]` | `os.getenv("STANZA_API_KEY")` | Your [Stanza API Key](https://stanzaapi.com). Required for production quotas. |
| `base_url` | `Optional[str]` | `"https://api.stanzaapi.com/gs1-decoder"` | Public edge API base URL. |
| `timeout` | `int` | `15` | Request timeout in seconds. |


---

## 🔗 Useful Links

* [GS1 Barcode & Digital Link Decoder Interactive Sandbox](https://stanzaapi.com/tools/gs1-decoder)
* [Stanza Developer Directory](https://stanzaapi.com)
* [Source Code & Issue Tracker](https://github.com/StanzaAPI/gs1-decoder-python)

## 📄 License

MIT © Stanza — Powered by [Stanza](https://stanzaapi.com).
