Skip to main content

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

Project description

pyznuny

PyPI version PyPI license

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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyznuny-0.0.11.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyznuny-0.0.11.tar.gz
Algorithm Hash digest
SHA256 14005a2519c83f5fb59d0a391e0512e6727054b49ce86e0b60be331105c908d4
MD5 138d3c0c893ad941bd1685aaafec0f04
BLAKE2b-256 bd89868ccb199f128334fe273f293a17be09d5f9e5e9328c8e3a6842f6ae4893

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyznuny-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyznuny-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 ef672b2c562a6992a810d912ad828471b00a1d818df3d515720fd7c6788e24d5
MD5 9b831893904163b13b83453f03cd0ba8
BLAKE2b-256 93a362a2b8c66229721779c82761602b791f65430754e8cb176dc31489f6b8e5

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