Python SDK for the Lansweeper Helpdesk API — create, search, and manage helpdesk tickets programmatically.
Project description
lansweeper-helpdesk
A Python SDK for the Lansweeper Helpdesk API. Create, retrieve, search, and manage helpdesk tickets programmatically.
Note: The Lansweeper Helpdesk API appears to be unmaintained and may be deprecated in the future. This SDK wraps the existing API as-is.
Installation
pip install lansweeper-helpdesk
Quick Start
from lansweeper_helpdesk import HelpdeskAPI
api = HelpdeskAPI(
base_url="https://your-helpdesk-url:443/api.aspx",
api_key="your-api-key",
cert_path="/path/to/cert.pem", # optional
)
# Create a ticket
ticket = api.create_ticket(
subject="Network Issue",
description="Cannot reach internal network",
email="user@example.com",
)
# Get ticket details (HTML is auto-stripped)
ticket = api.get_ticket("12345")
print(ticket["Description"])
API Reference
HelpdeskAPI(base_url, api_key, cert_path=None)
Initialize the client.
| Parameter | Type | Description |
|---|---|---|
base_url |
str |
Base URL of the Lansweeper Helpdesk API |
api_key |
str |
API key for authentication |
cert_path |
str or None |
Path to SSL certificate file (optional) |
Ticket Operations
create_ticket(subject, description, email) -> dict
Create a new helpdesk ticket.
api.create_ticket(
subject="Printer not working",
description="Office printer on floor 3 is offline",
email="user@company.com",
)
get_ticket(ticket_id) -> dict
Retrieve ticket details. HTML in the Description field is automatically converted to plain text.
ticket = api.get_ticket("12345")
get_ticket_history(ticket_id) -> list[dict]
Get all notes for a ticket. HTML content in note text fields is auto-stripped.
notes = api.get_ticket_history("12345")
for note in notes:
print(note["Text"])
edit_ticket(ticket_id, state, ticket_type, email) -> dict
Update a ticket's state and type.
api.edit_ticket(
ticket_id="12345",
state="Closed",
ticket_type="Hardware Repair",
email="agent@company.com",
)
Notes
add_note(ticket_id, text, email, note_type="Public") -> dict
Add a note to a ticket. Use note_type="Internal" for agent-only notes.
api.add_note(
ticket_id="12345",
text="Router restart resolved the issue",
email="agent@company.com",
note_type="Internal",
)
Search
search_tickets(*, state, from_user_id, agent_id, description, subject, ticket_type, max_results, min_date, max_date) -> dict
Search tickets with optional filters. All parameters are keyword-only and optional.
results = api.search_tickets(
state="Open",
ticket_type="Hardware Repair",
max_results=50,
min_date="2024-01-01",
max_date="2024-12-31",
)
get_user(email) -> dict
Look up a user by email address.
user = api.get_user("user@company.com")
Enums
The SDK provides convenience enums for common values:
from lansweeper_helpdesk import TicketState, NoteType
api.search_tickets(state=TicketState.OPEN)
api.add_note("12345", "note text", "a@b.com", note_type=NoteType.INTERNAL)
Error Handling
All API methods raise typed exceptions instead of returning None:
from lansweeper_helpdesk import HelpdeskAPI, APIError, ConfigurationError
try:
api = HelpdeskAPI(base_url="", api_key="key")
except ConfigurationError as e:
print(f"Bad config: {e}")
try:
ticket = api.get_ticket("99999")
except APIError as e:
print(f"API error (HTTP {e.status_code}): {e}")
| Exception | When |
|---|---|
HelpdeskError |
Base class for all SDK exceptions |
ConfigurationError |
Invalid client configuration |
APIError |
HTTP or API-level error (has .status_code) |
TicketNotFoundError |
Requested ticket does not exist |
Configuration
You can load credentials from a JSON config file:
import json
from lansweeper_helpdesk import HelpdeskAPI
with open("config/config.json") as f:
config = json.load(f)
api = HelpdeskAPI(**config)
Example config/config.json:
{
"base_url": "https://your-helpdesk-url:443/api.aspx",
"api_key": "your-api-key-here",
"cert_path": "path/to/your/certificate.pem"
}
Development
# Clone and install in dev mode
git clone https://github.com/ds-brandao/Lansweeper.Helpdesk-Python.git
cd Lansweeper.Helpdesk-Python
pip install -e ".[dev]"
# Run tests
pytest --cov
# Lint & format
ruff check src/ tests/
ruff format src/ tests/
# Type check
mypy src/
See CONTRIBUTING.md for full guidelines.
License
MIT License — see LICENSE for details.
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 lansweeper_helpdesk-0.1.0.tar.gz.
File metadata
- Download URL: lansweeper_helpdesk-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
728e96afd403f645273a0c2e6a2f5755f18190a6e49f3288ff6c33bdd583d134
|
|
| MD5 |
ad61cc3a4842a32cf3ede9e4c8c243c1
|
|
| BLAKE2b-256 |
50810b170249ba572024c7e1ae7b187fedbd17ea279b2088c3e0a4749c2c5be6
|
Provenance
The following attestation bundles were made for lansweeper_helpdesk-0.1.0.tar.gz:
Publisher:
publish.yml on ds-brandao/Lansweeper.Helpdesk-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lansweeper_helpdesk-0.1.0.tar.gz -
Subject digest:
728e96afd403f645273a0c2e6a2f5755f18190a6e49f3288ff6c33bdd583d134 - Sigstore transparency entry: 1191951490
- Sigstore integration time:
-
Permalink:
ds-brandao/Lansweeper.Helpdesk-Python@dde8cc05567700eb955484d8f91be0b3abdec0b0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ds-brandao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dde8cc05567700eb955484d8f91be0b3abdec0b0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lansweeper_helpdesk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lansweeper_helpdesk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a15ad3d649180a9b24ae8b63e95e103911b7eab6849a559af4ec5e776d4672e
|
|
| MD5 |
8e051d0268f6ae1224ee9e30369a6d01
|
|
| BLAKE2b-256 |
cd6919e9bf0c789c7b0936c8088c3e4b988ea3c2e5cf246e5f7669759146a193
|
Provenance
The following attestation bundles were made for lansweeper_helpdesk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ds-brandao/Lansweeper.Helpdesk-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lansweeper_helpdesk-0.1.0-py3-none-any.whl -
Subject digest:
9a15ad3d649180a9b24ae8b63e95e103911b7eab6849a559af4ec5e776d4672e - Sigstore transparency entry: 1191951496
- Sigstore integration time:
-
Permalink:
ds-brandao/Lansweeper.Helpdesk-Python@dde8cc05567700eb955484d8f91be0b3abdec0b0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ds-brandao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dde8cc05567700eb955484d8f91be0b3abdec0b0 -
Trigger Event:
release
-
Statement type: