Skip to main content

Sync and async Python client for NCCGEST REST API.

Project description

nccgest

English | Italiano | Русский

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

Full method-by-method documentation:

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

pip install nccgest

Quick Start (sync)

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)

Token Types

According to NCCGEST support:

  • cmd_read, cmd_insert, cmd_update use Customer Token
  • cmd_customer, cmd_driver use Master Token

You can pass them separately:

from nccgest import NCCGestClient

client = NCCGestClient(
    domain="your-domain",
    customer_token="CUSTOMER_TOKEN",
    master_token="MASTER_TOKEN",
)

Backward compatibility: token=... still works and is used for both token types.

Quick Start (async)

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

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

pip install -e ".[dev]"
pytest

Mock Service (FastAPI + SQLite)

Install mock dependencies:

pip install -e ".[mock]"

Run:

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

Alternative command:

nccgest-mock

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nccgest-0.1.5.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nccgest-0.1.5-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file nccgest-0.1.5.tar.gz.

File metadata

  • Download URL: nccgest-0.1.5.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for nccgest-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2fc2b2999a5000997ff9487217d24c1c678058480a317dfbc9cd0aae20a561cc
MD5 45d3ea51aea89c127115a8f4ee8610d3
BLAKE2b-256 d2c98754f03eead038255248be1a5dedb25d6266e2e70a489fbc4a8ff28b08c2

See more details on using hashes here.

File details

Details for the file nccgest-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: nccgest-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for nccgest-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 97ccf9b0ec32cbbc855da0b81bcd34143b04873c0f200e5b8d0f9dd0ed9e8527
MD5 dd3ad4463bb0af39f4eb89770b2b31d9
BLAKE2b-256 7815f54df213653f0301f493625d4fb2d6c88e0d84871c6d413197dcb3d7bc8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page