Metadata-Version: 2.4
Name: nccgest
Version: 0.1.1
Summary: Sync and async Python client for NCCGEST REST API.
Project-URL: Homepage, https://github.com/klishinoleg/nccgest
Project-URL: Repository, https://github.com/klishinoleg/nccgest
Project-URL: Issues, https://github.com/klishinoleg/nccgest/issues
Author: Oleg Klishin
License: MIT
License-File: LICENSE
Keywords: api,booking,nccgest,rest,transport
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: fastapi<1,>=0.115; extra == 'dev'
Requires-Dist: itsdangerous<3,>=2.2; extra == 'dev'
Requires-Dist: jinja2<4,>=3.1; extra == 'dev'
Requires-Dist: mypy>=1.14.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Requires-Dist: python-multipart>=0.0.9; extra == 'dev'
Requires-Dist: pyyaml<7,>=6.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Requires-Dist: twine>=6.0.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
Requires-Dist: uvicorn<1,>=0.35; extra == 'dev'
Provides-Extra: mock
Requires-Dist: fastapi<1,>=0.115; extra == 'mock'
Requires-Dist: itsdangerous<3,>=2.2; extra == 'mock'
Requires-Dist: jinja2<4,>=3.1; extra == 'mock'
Requires-Dist: python-multipart>=0.0.9; extra == 'mock'
Requires-Dist: pyyaml<7,>=6.0; extra == 'mock'
Requires-Dist: uvicorn<1,>=0.35; extra == 'mock'
Description-Content-Type: text/markdown

# nccgest

[English](README.md) | [Italiano](README.it.md) | [Русский](README.ru.md)

Python package for synchronous and asynchronous interaction with the NCCGEST REST API.

Full method-by-method documentation:

- [docs/library_api.ru.md](C:/python/pip/nccgest/docs/library_api.ru.md) (RU)

## Features

- Sync client: `NCCGestClient`
- Async client: `AsyncNCCGestClient`
- Command coverage:
  - `cmd_read`
  - `cmd_insert`
  - `cmd_update`
  - `cmd_customer`
  - `cmd_driver`
- Typed API errors and HTTP errors
- Python `3.8+` support (recommended runtime: `3.10+`)

## Installation

```bash
pip install nccgest
```

## Quick Start (sync)

```python
from nccgest import NCCGestClient

with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
    services = client.read_services(start_date="16/03/2026", end_date="16/03/2026")
    print(services)
```

## Quick Start (async)

```python
import asyncio
from nccgest import AsyncNCCGestClient

async def main() -> None:
    async with AsyncNCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
        driver_data = await client.get_driver_data(driverid=123)
        print(driver_data)

asyncio.run(main())
```

## Insert Service Example

```python
from nccgest import NCCGestClient

payload = {
    "pickup": "FCO",
    "dropoff": "Roma",
    "date": "16/03/2026",
    "pickup_time": "10:30",
    "pax": 2,
    "paxname": "John Smith",
    "paxphone": "+39000000000",
    "servicetype": "Transfer",
    "cartype": "Business Class",
    "subclass": "EXT-ORDER-12345",
}

with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
    service_id = client.insert_service(payload)
    print(service_id)
```

## API Notes

- Use HTTPS only.
- NCCGEST API docs mention no concurrent inserts: avoid parallel create calls.
- Use proper URL encoding for external inputs.
- Follow official endpoint method mapping (`GET` for read/customer/driver, `POST` for insert/update).

## Development

```bash
pip install -e ".[dev]"
pytest
```

## Mock Service (FastAPI + SQLite)

Install mock dependencies:

```bash
pip install -e ".[mock]"
```

Run:

```bash
NCCGEST_LOGIN=test NCCGEST_PASSWORD=test NCCGEST_DBDIR=/data NCCGEST_PORT=8255 python -m nccgest.mock_service
```

Alternative command:

```bash
nccgest-mock
```

If required mock modules are missing, `nccgest-mock` prints install instructions:

```bash
pip install "nccgest[mock]"
# or for local repo:
pip install -e ".[mock]"
```

Web UI:

- Login page: `http://localhost:8255/admin/login`
- Services admin: `http://localhost:8255/admin/services`
- Customers admin: `http://localhost:8255/admin/customers`
- Drivers admin: `http://localhost:8255/admin/drivers`
- API endpoint: `http://localhost:8255/api/rest_api.php`

The `/data` directory is ignored by git and used for the local SQLite DB.
Mock YAML fixtures for tests are stored in `tests/mock_data/services.yaml`.
UI templates and CSS are separated in:

- `src/nccgest/mock_service/templates/*.html`
- `src/nccgest/mock_service/static/style.css`
