Skip to main content

qtx-nav-core

Python package for the NAV Online Szamla core client.

Install/package name: qtx-nav-core

Python import package: qtx_nav_core

Quick Start Map

If you open this package months later, start with this mental model:

  • NavAuth: technical user credentials for NAV signing and authentication
  • NavSoftwareInfo: software metadata block included in each request
  • NavRequestContext: immutable container that carries auth, software info, and request ID prefix
  • NavRequestBody: abstract extension point for a concrete NAV operation
  • NavXmlRequestBuilder: creates the full NAV XML document from context plus request body
  • NavApiClient: low-level HTTP client for XML requests, multipart uploads, and multipart responses
  • NavApiResponse: HTTP status, headers, parsed XML document, and received multipart parts
  • NavCallSpec: one request execution description, including path and optional file upload settings
  • NavRequestRunner: high-level orchestrator that builds XML, sends the request, and validates NAV result status
  • NavDocumentStatus: parsed summary of NAV's <result> block
  • NavApiKind / NAV_XML_PROFILES: NAV API profile selection for OSA/eVAT namespaces and request versions
  • NavUtils: shared helper methods for hashing, decoding, status parsing, and response formatting

Typical Usage Flow

  1. Create a NavAuth instance.
  2. Create a NavSoftwareInfo instance for the calling application.
  3. Create a NavRequestContext from the auth object and software info.
  4. Implement a concrete NavRequestBody subclass for the target NAV endpoint.
  5. Create a NavApiClient with the NAV base URL.
  6. Create a NavRequestRunner with the API client and request context.
  7. Execute the call with NavCallSpec.
  8. Read the returned NavApiResponse.document and, for multipart responses, NavApiResponse.parts.
  9. Let NavValidationError surface NAV-side failures when enabled.

Response Handling

NavRequestRunner.call(...) returns the full NavApiResponse, not only the XML document. This keeps the HTTP status and headers available and also exposes multipart response parts returned by NAV.

For endpoints that can return multipart content, pass multipart_response=True to runner.call(...). The client sends an Accept header that allows multipart responses, parses the MIME parts, stores them in NavApiResponse.parts, and uses the first XML part as NavApiResponse.document when one is present.

response = runner.call(
    NavCallSpec(path="/query", request_body=request_body),
    multipart_response=True,
)

xml_document = response.document
for part in response.iter_parts():
    print(part.name, part.filename, part.content_type, len(part.content))

API Kind Detection

NavApiClient.api_kind is derived from the configured base URL. URLs containing .eafa. use NavApiKind.EVAT; URLs containing .onlineszamla. use NavApiKind.OSA. NavRequestRunner passes this value to NavXmlRequestBuilder, which then selects the matching XML namespaces and request version from NAV_XML_PROFILES.

This version supports the eVAT 2.0 XSD schema set through the eVAT XML profile. For eVAT URLs, generated requests use the EAR 2.0 API/base/data namespaces together with the NAV common namespace.

Software Info

NavSoftwareInfo is required for every request. Create and pass a populated instance into NavRequestContext; otherwise XML generation raises ValueError before the NAV call is sent.

The current model defaults are empty development placeholders only. Real callers must set the software identifier, name, version, developer contact, developer country code, and developer tax number explicitly.

software = NavSoftwareInfo(
    software_id="MOCK-EVAT-12345678",
    software_name="Mock eVAT Client",
    software_operation="LOCAL_SOFTWARE",
    software_main_version="1.0",
    software_dev_name="Mock Developer",
    software_dev_contact="mock.dev@example.com",
    software_dev_country_code="HU",
    software_dev_tax_number="12345678",
)

context = NavRequestContext(auth=auth, software=software)

Release Notes

0.2.4

This release only changes generated NAV request IDs: NavXmlRequestBuilder now uses request_id_prefix + UTC timestamp with microseconds and validates the generated requestId against NAV's 30 character limit and allowed character set. No public API or request/response model behavior was intentionally changed.

Package Reference

For a longer in-package reminder that is shipped with the installed distribution, see qtx_nav_core/docs/package_map.md.

Scope

This package currently contains:

  • package layout matching the Dart core library
  • public exports for auth, request building, request running, API responses, and multipart parts
  • models, services, and utils for NAV XML and HTTP calls
  • tests and tooling configuration

Package layout

qtx_nav_core/
  models/
  services/
  utils/
tests/

Development

pip install -e .[dev]
pytest
ruff check .

Download files

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

Source Distribution

qtx_nav_core-0.2.4.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

qtx_nav_core-0.2.4-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file qtx_nav_core-0.2.4.tar.gz.

File metadata

  • Download URL: qtx_nav_core-0.2.4.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for qtx_nav_core-0.2.4.tar.gz
Algorithm Hash digest
SHA256 fd3363f5f23075a8a6c4707c57f14af41e26edc5e37a45bda5c5931d4f6afdc6
MD5 6be4cda777d57b0c102342125f019696
BLAKE2b-256 885ffc9a72a96d73a63e84968cf320817aec71a443d378bc259f65b53df5797d

See more details on using hashes here.

File details

Details for the file qtx_nav_core-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: qtx_nav_core-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for qtx_nav_core-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 190fdbdde762b92801e1e303141fadf62225956b5130213d1f86d332e989baa5
MD5 18564c5de38dfe65b5a1fb3edc9954ea
BLAKE2b-256 d296bdeb05c8e8b87a18cfe7dddbecc35095e786f61574ecf8f11aa5dbd4bc95

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page