Skip to main content

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

Project description

pyznuny

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

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.

License

MIT

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-0.0.7.tar.gz (9.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-0.0.7-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyznuny-0.0.7.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for pyznuny-0.0.7.tar.gz
Algorithm Hash digest
SHA256 46100f7ce2a10e0c121a21e0724c76ca29ff4febf96730fc9dee7894b1b6ac43
MD5 f7f03d7c55ffc84fa3d1262f21533538
BLAKE2b-256 8d3d3fe5e4303d08a63b7528f5aaf69087d3dfab2a52f28dd39cddc5f8524175

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyznuny-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for pyznuny-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f74e4b3ee643bd53ff49bc1164f975de1e1abaa634daaa09f3aa240feb18b2f1
MD5 931421620de2db47c329fe4e5ba43aed
BLAKE2b-256 972c8e056e2532e2b19f92aa0a9769c8618eaf40d90f2472718ec773b5dc1139

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