Skip to main content

A Python client for interacting with the Znuny ticketing system API.

Project description

pyznuny

PyPI version PyPI license PyPI Dowloads

A Python client for interacting with the Znuny ticketing system API.

Features

  • Simple, typed client built on httpx
  • Ticket create, update, and get routes
  • Easy custom endpoint configuration

Installation

pip install pyznuny

Or with uv:

uv add pyznuny

Documentation

For a complete API Reference and guide on how to use pyznuny, please visit our documentation

Quick start

Create a client and authenticate using environment variables.

from pyznuny import TicketClient
from dotenv import load_dotenv
import os

load_dotenv()

client = TicketClient(
    base_url=os.getenv("HOST"),
    username=os.getenv("USER_LOGIN"),
    password=os.getenv("PASSWORD"),
)

Example .env:

HOST=https://your-znuny-instance.com
USER_LOGIN=your-username
PASSWORD=your-password

Usage examples

Create a ticket

payload = {
    "Ticket": {
        "Title": "Ticket Title",
        "Queue": "Ticket queue",
        "State": "Ticket state",
        "Priority": "Ticket priority",
        "CustomerUser": "customer@example.com",
    },
    "Article": {
        "Subject": "Ticket subject",
        "Body": "Ticket body...",
        "ContentType": "text/plain; charset=utf-8",
        "From": "customer@example.com",
    },
}

response = client.ticket.create(payload=payload)
print(response.json())

Get a ticket by ID

# default endpoint is GET /Ticket/{ticket_id}
response = client.ticket.get(ticket_id=1234)
print(response.json())

Update a ticket

response = client.ticket.update(
    ticket_id=1234,
    Ticket={"State": "open"},
)
print(response.json())

Customize endpoints

If your Znuny instance uses different paths, set them with the endpoint setter.

# Example: custom ticket get endpoint and identifier
client.set_endpoint.ticket_get(endpoint="Tickets/{id}", identifier="id")

response = client.ticket.get(ticket_id=1234)

Notes

  • When username and password are provided, the client logs in and stores session_id automatically.
  • You can pass a pre-configured httpx.Client via client=... if needed.
  • You can send payloads as plain dicts using the same attributes shown in the examples.

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

pyznuny-1.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

pyznuny-1.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file pyznuny-1.1.0.tar.gz.

File metadata

  • Download URL: pyznuny-1.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyznuny-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8dc0c658834c10923fe79fd3be0192430dec491df833ea976ef645cfe3066984
MD5 c2deac2b564bba92fcf999affb2c2b5e
BLAKE2b-256 1773cf66005aff5b98ec689fa085228556a7edb075e7d40c26b193c1dcd7f56e

See more details on using hashes here.

File details

Details for the file pyznuny-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyznuny-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyznuny-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 951171763d574bbe8cffa36bf55169c35a92ee0284e251d873fdb2a66712bf3e
MD5 634b6123a159718c931da6c24d116043
BLAKE2b-256 d32c3862505dc87c14b8f1809bc0d2081ec5ce8474a5bd6c5af7994fc5808e8b

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