From 55ca5c9e3118d53d78e9be27d7339b79f7325c32 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 29 Jul 2022 00:50:27 +0200 Subject: [PATCH] docs: setup pdoc3 --- Makefile | 10 ++++++++++ pyzabbix/api.py | 27 ++++++++++++++------------- setup.py | 1 + 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 3f76ef2..0bdeff7 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,16 @@ e2e: $(VENV) source $(VENV)/bin/activate $(PYTEST_CMD) e2e +.PHONY: docs +docs: $(VENV) + source $(VENV)/bin/activate + pdoc3 --html --force --output-dir docs pyzabbix + +.PHONY: docs +docs-watch: $(VENV) + source $(VENV)/bin/activate + pdoc3 --http :8081 pyzabbix + build: $(VENV) source $(VENV)/bin/activate python -m build . diff --git a/pyzabbix/api.py b/pyzabbix/api.py index 16e7176..8103e67 100644 --- a/pyzabbix/api.py +++ b/pyzabbix/api.py @@ -1,4 +1,4 @@ -# pylint: disable=wrong-import-order +# pylint: disable=wrong-import-order,line-too-long import logging from typing import Mapping, Optional, Sequence, Tuple, Union @@ -21,18 +21,19 @@ class ZabbixAPIException(Exception): - """Generic Zabbix API exception - - Codes: - -32700: invalid JSON. An error occurred on the server while - parsing the JSON text (typo, wrong quotes, etc.) - -32600: received JSON is not a valid JSON-RPC Request - -32601: requested remote-procedure does not exist - -32602: invalid method parameters - -32603: Internal JSON-RPC error - -32400: System error - -32300: Transport error - -32500: Application error + """Zabbix API Exception + + Codes are based on the [jsonrpc specification](https://www.jsonrpc.org/specification#error_object). + + - `-32700` `Parse error`: Invalid JSON was received by the server. + - `-32600` `Invalid Request`: The JSON sent is not a valid Request object. + - `-32601` `Method not found`: The method does not exist / is not available. + - `-32602` `Invalid params`: Invalid method parameter(s). + - `-32603` `Internal error`: Internal JSON-RPC error. + - `-32000` to `-32099` `Server error`: Reserved for implementation-defined server-errors. + - `-32400` `System error` + - `-32300` `Transport error` + - `-32500` `Application error` """ def __init__(self, *args, **kwargs): diff --git a/setup.py b/setup.py index b185915..cb94f5c 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ "black", "isort", "mypy", + "pdoc3", "pylint", "pytest-cov", "pytest-xdist",