Skip to content

Commit

Permalink
Port Python 2 API to Python 3
Browse files Browse the repository at this point in the history
Copy livestatus Python API from `api/python` to `api/python3` and make
necessary changes to run under Python 3 (somewhat tested on 3.6).

The original GPL'ed sources are from commit
e06cefe.

Signed-off-by: Aksel Sjögren <asjogren@itrsgroup.com>
  • Loading branch information
sjoegren committed Dec 1, 2021
1 parent 15d9315 commit 451696b
Show file tree
Hide file tree
Showing 5 changed files with 661 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/python/example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python2
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down
3 changes: 2 additions & 1 deletion api/python/example_multisite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python2
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand All @@ -25,6 +25,7 @@
# Boston, MA 02110-1301 USA.

import os
import sys
import livestatus

try:
Expand Down
2 changes: 2 additions & 0 deletions api/python3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This Python package is a Python 3 port of the Python 2 `livestatus` package.
See [../python/README](../python/README).
19 changes: 19 additions & 0 deletions api/python3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .livestatus import (
SingleSiteConnection,
MultiSiteConnection,
MKLivestatusException,
MKLivestatusSocketError,
MKLivestatusSocketClosed,
MKLivestatusQueryError,
MKLivestatusNotFoundError,
)

__all__ = [
"SingleSiteConnection",
"MultiSiteConnection",
"MKLivestatusException",
"MKLivestatusSocketError",
"MKLivestatusSocketClosed",
"MKLivestatusQueryError",
"MKLivestatusNotFoundError",
]
Loading

0 comments on commit 451696b

Please sign in to comment.