pywebexec 2.0.5__py3-none-any.whl → 2.0.7__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.
- pywebexec/pywebexec.py +1 -1
- pywebexec/static/css/form.css +1 -0
- pywebexec/static/css/markdown.css +6 -1
- pywebexec/static/css/style.css +2 -2
- pywebexec/static/js/executables.js +1 -1
- pywebexec/swagger.yaml +1 -1
- pywebexec/version.py +2 -2
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/METADATA +57 -2
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/RECORD +13 -13
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/LICENSE +0 -0
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/WHEEL +0 -0
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/entry_points.txt +0 -0
- {pywebexec-2.0.5.dist-info → pywebexec-2.0.7.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
pywebexec/static/css/form.css
CHANGED
pywebexec/static/css/style.css
CHANGED
@@ -420,7 +420,7 @@ body.dimmed * {
|
|
420
420
|
font-size: 13px;
|
421
421
|
}
|
422
422
|
.command-line {
|
423
|
-
padding:
|
423
|
+
padding: 5px 10px 6px 10px;
|
424
424
|
background-color: #111;
|
425
425
|
color: #eee;
|
426
426
|
max-width: 300px;
|
@@ -429,7 +429,7 @@ body.dimmed * {
|
|
429
429
|
overflow: hidden;
|
430
430
|
text-overflow: ellipsis;
|
431
431
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
432
|
-
font-size:
|
432
|
+
font-size: 14px;
|
433
433
|
}
|
434
434
|
|
435
435
|
.nbrunning {
|
@@ -34,7 +34,7 @@ function filterCommands() {
|
|
34
34
|
items[i].style.display = 'none';
|
35
35
|
}
|
36
36
|
}
|
37
|
-
if (nbVisibleItems > 1) {
|
37
|
+
if (nbVisibleItems > 1 || commandInput.value.length == 0) {
|
38
38
|
commandListDiv.style.display = 'block';
|
39
39
|
} else {
|
40
40
|
commandListDiv.style.display = 'none';
|
pywebexec/swagger.yaml
CHANGED
pywebexec/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pywebexec
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.7
|
4
4
|
Summary: Simple Python HTTP Exec Server
|
5
5
|
Home-page: https://github.com/joknarf/pywebexec
|
6
6
|
Author: Franck Jouvanceau
|
@@ -208,12 +208,67 @@ The help message is displayed:
|
|
208
208
|
|
209
209
|
<img src="https://github.com/user-attachments/assets/2d69cef2-3371-4282-99bb-e994eb0c0b24" width="400"/>
|
210
210
|
|
211
|
+
## Add schema to commands
|
212
|
+
|
213
|
+
For each exposed command, you can add a schema by creating a file named `<command>.schema.yaml` in the same directory as the command. The schema must be written in yaml format.
|
214
|
+
The schema is used to generate a form in the web interface and in the swagger-ui in the `/commands/<command>` route.
|
215
|
+
The schema is also used to validate the input parameters when calling the API `/commands/<command>`.
|
216
|
+
The schema must be written in the openapi schema format.
|
217
|
+
|
218
|
+
```yaml
|
219
|
+
type: object
|
220
|
+
properties:
|
221
|
+
param1:
|
222
|
+
type: string
|
223
|
+
description: "param1 description"
|
224
|
+
example: "value"
|
225
|
+
param2:
|
226
|
+
type: integer
|
227
|
+
description: "param2 description"
|
228
|
+
enum: [1, 2, 3]
|
229
|
+
param3:
|
230
|
+
type: array
|
231
|
+
items:
|
232
|
+
type: string
|
233
|
+
description: "param3 description"
|
234
|
+
example: ["value1", "value2"]
|
235
|
+
required:
|
236
|
+
- param1
|
237
|
+
- param2
|
238
|
+
```
|
239
|
+
The payload will be converted to command line arguments when calling the command.
|
240
|
+
```
|
241
|
+
command --param1 value --param2 1 --param3 value1 value2
|
242
|
+
```
|
243
|
+
|
244
|
+
* On the web inferface, and swagger-ui the form will be generated from the schema.
|
245
|
+
|
246
|
+
<img src="https://github.com/user-attachments/assets/c7cdf117-aa38-4366-97c7-1aa26e5ebf0d" width=400>
|
247
|
+
|
248
|
+
When using schema, the command can now be launched with:
|
249
|
+
```
|
250
|
+
$ curl -X POST http://<srv>/commands/<cmd> -H "Content-Type: application/json" -d '{"param1": "value", "param2": 1, "param3": ["value1", "value2"]}'
|
251
|
+
```
|
252
|
+
|
253
|
+
## Schema options
|
254
|
+
|
255
|
+
The schema options are used to customize the command line arguments generation, just add a `schema_options` section to the schema.
|
256
|
+
```yaml
|
257
|
+
schema_options:
|
258
|
+
separator: "=" # --param=value (default is " ")
|
259
|
+
noprefix_params: ["param1", "param2"] # omit --param prefix, use "*" to omit all
|
260
|
+
convert_params: {"param1": "param2"} # convert param1 to param2
|
261
|
+
```
|
262
|
+
|
211
263
|
## Swagger UI
|
212
264
|
|
213
|
-
A swagger UI is available at `http[s]://<srv>/v0/documentation`
|
265
|
+
A custom swagger UI is available at `http[s]://<srv>/v0/documentation` with enhanced markdown rendering and form generation for body parameters.
|
214
266
|
|
215
267
|
<img src="https://github.com/user-attachments/assets/c80a341e-c04c-4606-9510-a57b473a74e5" width="400"/>
|
216
268
|
|
269
|
+
<img src="https://github.com/user-attachments/assets/22261048-459e-4ace-8d04-c568d67bef37" width="400">
|
270
|
+
|
271
|
+
|
217
272
|
## API reference
|
218
273
|
|
219
274
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
|
2
2
|
pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
|
3
|
-
pywebexec/pywebexec.py,sha256=
|
4
|
-
pywebexec/swagger.yaml,sha256=
|
5
|
-
pywebexec/version.py,sha256=
|
6
|
-
pywebexec/static/css/form.css,sha256=
|
7
|
-
pywebexec/static/css/markdown.css,sha256=
|
8
|
-
pywebexec/static/css/style.css,sha256=
|
3
|
+
pywebexec/pywebexec.py,sha256=bC9mOWBsOEVX_70BfJl6tF-4T0tm2WXcBvxcLprN4rw,40738
|
4
|
+
pywebexec/swagger.yaml,sha256=j-KZnU4rGR-Fsk8y_EbqYzqVgtAZ8EjZIKAqZSxyyc0,5858
|
5
|
+
pywebexec/version.py,sha256=ulUZ6lrSexVngMnKPLgJd8su0H8_WYJENJZUKBoZlaY,511
|
6
|
+
pywebexec/static/css/form.css,sha256=Qb0lQYqe2Pdk7BmJ_YTts2zA8e_9dJYp-4tuRbeCCYg,3553
|
7
|
+
pywebexec/static/css/markdown.css,sha256=3RzUnpVBdF6cQuB_NXV7hMTc0quYU8sfyuZcpsREj6A,1939
|
8
|
+
pywebexec/static/css/style.css,sha256=o5iWsFOYtP1W-R_lTcWoaxzlh8EoaL__ycVZOori1Ws,9434
|
9
9
|
pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
|
10
10
|
pywebexec/static/css/swagger-ui.css.map,sha256=dJy-xBn_htK4BNupTMIl33ddse7BXsrCdDJWlTJodnw,258842
|
11
11
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
@@ -33,7 +33,7 @@ pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65Eiuw
|
|
33
33
|
pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy6JQMww,610
|
34
34
|
pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
|
35
35
|
pywebexec/static/images/swagger-ui.svg,sha256=FR0yeOVwe4zCYKZAjCGcT_m0Mf25NexIVaSXifIkoU0,2117
|
36
|
-
pywebexec/static/js/executables.js,sha256=
|
36
|
+
pywebexec/static/js/executables.js,sha256=iltgIJXWVUxAUhBfXGCHSP8mK8cQdtg-AagbGe7Hv9o,11762
|
37
37
|
pywebexec/static/js/popup.js,sha256=0fr3pp4j9D2fXEVnHyQrx2bPWFHfgbb336dbewgH1d8,9023
|
38
38
|
pywebexec/static/js/schemaform.js,sha256=bd874Geg9vri1c_seUGVynxZswGb5IcyWLZxYlcryCA,2784
|
39
39
|
pywebexec/static/js/script.js,sha256=fwTo9Iz4xsl6wGs-Nm8-Ng8aXzDfvews5cHfzhSfg_0,17987
|
@@ -66,9 +66,9 @@ pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
66
66
|
pywebexec/templates/index.html,sha256=KeNLBH9PN_ZuGhzwrjvRTj2oBtbINv_SbwGQpOahNWo,3820
|
67
67
|
pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
|
68
68
|
pywebexec/templates/swagger_ui.html,sha256=9ngyldkyEdLonBjl97mbIZUlVk-jxwcHrvFzMSrveyU,1067
|
69
|
-
pywebexec-2.0.
|
70
|
-
pywebexec-2.0.
|
71
|
-
pywebexec-2.0.
|
72
|
-
pywebexec-2.0.
|
73
|
-
pywebexec-2.0.
|
74
|
-
pywebexec-2.0.
|
69
|
+
pywebexec-2.0.7.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
70
|
+
pywebexec-2.0.7.dist-info/METADATA,sha256=wZzuVLc2sLW12_4aILoewmns_fAYGdSO4LCr6z4gbvo,11615
|
71
|
+
pywebexec-2.0.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
72
|
+
pywebexec-2.0.7.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
73
|
+
pywebexec-2.0.7.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
74
|
+
pywebexec-2.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|