pylego 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pylego/lego.so +0 -0
- {pylego-0.1.1.dist-info → pylego-0.1.2.dist-info}/METADATA +2 -2
- pylego-0.1.2.dist-info/RECORD +8 -0
- {pylego-0.1.1.dist-info → pylego-0.1.2.dist-info}/WHEEL +1 -1
- lepy/__init__.py +0 -1
- lepy/lego.so +0 -0
- lepy/lepy.py +0 -68
- pylego-0.1.1.dist-info/RECORD +0 -11
- {pylego-0.1.1.dist-info → pylego-0.1.2.dist-info}/LICENSE +0 -0
- {pylego-0.1.1.dist-info → pylego-0.1.2.dist-info}/top_level.txt +0 -0
pylego/lego.so
CHANGED
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pylego
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A python wrapper package for the lego application written in Golang
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Canonical <telco-engineers@lists.canonical.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/canonical/pylego
|
|
7
7
|
Project-URL: Issues, https://github.com/canonical/pylego/issues
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pylego/__init__.py,sha256=sYJobFIJ2iCzyicqTfQmqggMC-6-t9eO8fCtxG_6Q60,57
|
|
2
|
+
pylego/lego.so,sha256=rpi2KEj_rsKAXTjUnWFS2YHRxtKM5OUlkFMBcilMo1A,139818208
|
|
3
|
+
pylego/pylego.py,sha256=bHsVzqMM2DZmhCAn-yqlxKQ4Pr5QRyOpBjP2dJSBKMU,1976
|
|
4
|
+
pylego-0.1.2.dist-info/LICENSE,sha256=aklz9Y8CIpFsN61U4jHlJYp4W_8HoDpY-tINlDcdSZY,10934
|
|
5
|
+
pylego-0.1.2.dist-info/METADATA,sha256=Pv59fdUzVFSCycCXkV8dy5uk0FfOU8-n2C0u8B3lESE,5489
|
|
6
|
+
pylego-0.1.2.dist-info/WHEEL,sha256=Rp8gFpivVLXx-k3U95ozHnQw8yDcPxmhOpn_Gx8d5nc,91
|
|
7
|
+
pylego-0.1.2.dist-info/top_level.txt,sha256=pSOYv55_w90qy3xOvqz_ysSz-X-XRTb-jMpiOyLNnNs,7
|
|
8
|
+
pylego-0.1.2.dist-info/RECORD,,
|
lepy/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .lepy import run_lego_command # noqa: F401, D104
|
lepy/lego.so
DELETED
|
Binary file
|
lepy/lepy.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"""Python interface that wraps the lego application CLI."""
|
|
2
|
-
|
|
3
|
-
import ctypes
|
|
4
|
-
import json
|
|
5
|
-
from dataclasses import dataclass
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
here = Path(__file__).absolute().parent
|
|
9
|
-
so_file = here / ("lego.so")
|
|
10
|
-
library = ctypes.cdll.LoadLibrary(so_file)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@dataclass
|
|
14
|
-
class Metadata:
|
|
15
|
-
"""Extra information returned by the ACME server."""
|
|
16
|
-
|
|
17
|
-
stable_url: str
|
|
18
|
-
url: str
|
|
19
|
-
domain: str
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@dataclass
|
|
23
|
-
class LEGOResponse:
|
|
24
|
-
"""The class that lego returns when issuing certificates correctly."""
|
|
25
|
-
|
|
26
|
-
csr: str
|
|
27
|
-
private_key: str
|
|
28
|
-
certificate: str
|
|
29
|
-
issuer_certificate: str
|
|
30
|
-
metadata: Metadata
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class LEGOError(Exception):
|
|
34
|
-
"""Exceptions that are returned from the LEGO Go library."""
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def run_lego_command(
|
|
38
|
-
email: str, server: str, csr: bytes, env: dict[str, str], plugin: str = ""
|
|
39
|
-
) -> LEGOResponse:
|
|
40
|
-
"""Run an arbitrary command in the Lego application. Read more at https://go-acme.github.io.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
email: the email to be used for registration
|
|
44
|
-
server: the server to be used for requesting a certificate that implements the ACME protocol
|
|
45
|
-
csr: the csr to be signed
|
|
46
|
-
plugin: which DNS provider plugin to use for the request. Find yours at https://go-acme.github.io/lego/dns/.
|
|
47
|
-
env: the environment variables required for the chosen plugin.
|
|
48
|
-
"""
|
|
49
|
-
library.RunLegoCommand.restype = ctypes.c_char_p
|
|
50
|
-
library.RunLegoCommand.argtypes = [ctypes.c_char_p]
|
|
51
|
-
|
|
52
|
-
message = bytes(
|
|
53
|
-
json.dumps(
|
|
54
|
-
{
|
|
55
|
-
"email": email,
|
|
56
|
-
"server": server,
|
|
57
|
-
"csr": csr.decode(),
|
|
58
|
-
"plugin": plugin,
|
|
59
|
-
"env": env,
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
"utf-8",
|
|
63
|
-
)
|
|
64
|
-
result: bytes = library.RunLegoCommand(message)
|
|
65
|
-
if result.startswith(b"error:"):
|
|
66
|
-
raise LEGOError(result.decode())
|
|
67
|
-
result_dict = json.loads(result.decode("utf-8"))
|
|
68
|
-
return LEGOResponse(**{**result_dict, "metadata": Metadata(**result_dict.get("metadata"))})
|
pylego-0.1.1.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
lepy/__init__.py,sha256=lNrZ_WOjt5h5FHjjAP7o33gWjB4Es6vy14HumYw8Zwc,55
|
|
2
|
-
lepy/lego.so,sha256=az4OrMPJwDr7QQm7CiF-wBCcL1db9yl5y_nV_HuxjCg,107322610
|
|
3
|
-
lepy/lepy.py,sha256=bHsVzqMM2DZmhCAn-yqlxKQ4Pr5QRyOpBjP2dJSBKMU,1976
|
|
4
|
-
pylego/__init__.py,sha256=sYJobFIJ2iCzyicqTfQmqggMC-6-t9eO8fCtxG_6Q60,57
|
|
5
|
-
pylego/lego.so,sha256=37boO1hPIh_1L0Rx0i1OEttzpx-1OH7NiYCVvl8vFD4,107322610
|
|
6
|
-
pylego/pylego.py,sha256=bHsVzqMM2DZmhCAn-yqlxKQ4Pr5QRyOpBjP2dJSBKMU,1976
|
|
7
|
-
pylego-0.1.1.dist-info/LICENSE,sha256=aklz9Y8CIpFsN61U4jHlJYp4W_8HoDpY-tINlDcdSZY,10934
|
|
8
|
-
pylego-0.1.1.dist-info/METADATA,sha256=qYm_qDIvYcTwE4eDW5vbYpmdSly3iFDgL5pJauy48Qo,5681
|
|
9
|
-
pylego-0.1.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
10
|
-
pylego-0.1.1.dist-info/top_level.txt,sha256=pSOYv55_w90qy3xOvqz_ysSz-X-XRTb-jMpiOyLNnNs,7
|
|
11
|
-
pylego-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|