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
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
usernameandpasswordare provided, the client logs in and storessession_idautomatically. - You can pass a pre-configured
httpx.Clientviaclient=...if needed. - You can send payloads as plain dicts using the same attributes shown in the examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyznuny-0.0.16.tar.gz.
File metadata
- Download URL: pyznuny-0.0.16.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9437639fff7273ad1e68595b9073345518513a4e71580f65562c77a695fca336
|
|
| MD5 |
0752543c93b90234a380b59d329aa70b
|
|
| BLAKE2b-256 |
0c0c9adfc46a1ba758a65e32b9d91947fb91456d10a89b29dd47660fb1a7e354
|
File details
Details for the file pyznuny-0.0.16-py3-none-any.whl.
File metadata
- Download URL: pyznuny-0.0.16-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37acafa7fa0a8d63f092da4321b1c61df2af05de441f61804a945be4e6d9cf9
|
|
| MD5 |
6e12e01a7dba8a2ec3d87f7fb4d46d60
|
|
| BLAKE2b-256 |
aba279b8af3233fe4b2ac5b4e1c4f6c0f09a2dbf21cc65a3ab519b3b4491ff1d
|