Skip to main content

Simple Python HTTP Exec Server

Project description

Pypi version example Licence Python versions

pywebexec

Simple Python HTTP(S) API/Web Command Launcher

Install

$ pip install pywebexec

Quick start

  • start http server serving current directory executables listening on 0.0.0.0 port 8080
$ pywebexec
  • Launch commands with params/view live output/Status using browser image

features

  • Serve executables in a directory
  • Launch commands with params from web browser or API call
  • Follow live output
  • Stop command
  • Relaunch command
  • HTTPS support
  • HTTPS self-signed certificate generator
  • Can be started as a daemon (POSIX)
  • uses gunicorn to serve http/https
  • compatible Linux/MacOS

Customize server

$ pywebexec --dir ~/myscripts --listen 0.0.0.0 --port 8080
$ pywebexec -d ~/myscripts -l 0.0.0.0 -p 8080

Basic auth user/password

$ pywebexec --user myuser [--password mypass]
$ pywebfs -u myuser [-P mypass]

Generated password is given if no --pasword option

HTTPS server

  • Generate auto-signed certificate and start https server
$ pywebfs --gencert
$ pywebfs --g
  • Start https server using existing certificate
$ pywebfs --cert /pathto/host.cert --key /pathto/host.key
$ pywebfs -c /pathto/host.cert -k /pathto/host.key

Launch server as a daemon

$ pywebexec start
$ pywebexec status
$ pywebexec stop
  • log of server are stored in directory [.config/].pywebexec/pywebexec_<listen>:<port>.log

Launch command through API

# curl http://myhost:8080/run_script -H 'Content-Type: application/json' -X POST -d '{ "script_name":"myscript", "param":["param1", ...]}

API reference

method route params/payload returns
POST /run_command command: str
params: array[str]
command_id: uuid
message: str
POST /stop_command/command_id message: str
GET /command_status/command_id command_id: uuid
command: str
params: array[str]
start_time: isotime
end_time: isotime
status: str
exit_code: int
GET /command_output/command_id output: str
status: str
GET /commands array of
command_id: uuid
command: str
start_time: isotime
end_time: isotime
status: str
exit_code: int
GET /executables array of str

Project details


Release history Release notifications | RSS feed

This version

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywebexec-1.0.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywebexec-1.0.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file pywebexec-1.0.0.tar.gz.

File metadata

  • Download URL: pywebexec-1.0.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for pywebexec-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b1195d9226602452b7ad0e2c19b6944328803c65ea320d36253f1148ecb3b152
MD5 870f3784c820a32df77f2caac962418a
BLAKE2b-256 7a37f5ba281423ab5264927a5fa3d80f3591f049c26bf1959a020dc06231e96e

See more details on using hashes here.

File details

Details for the file pywebexec-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pywebexec-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for pywebexec-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b662cb0e52d4adfa41077579b8f7b213f08a07b415fbcdf2b3dbacd180b44595
MD5 1ff7f1405a1e84b9b208d9f9dd1c3060
BLAKE2b-256 41fbbd20e51de008fd711e1e63cca56c3128ed672cead23ec86f6fa7b889c8b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page