Skip to main content

An easy to use Web interface for python application.

Project description

Web-CLI

Easy to use Web CLI for python applications.

Table of content

Usage

Import and make a instantiate it.

settings = Settings(name="Example page")
server = WebCLIServer(settings, backend)

fun backend(user_command: UserCommand) -> None:
    # do stuff here

After, start the server with server.start().

server.start()

The example provded will result in a webserver opened on 127.0.0.1:8080 (localhost:8080). Opening this page will result in a command line looking webpage that can communicate with the server.

Settings

  • host: Host's IP.
  • port: Port for the IP address.
  • name: Name of the web server.

functions

to_file

  • string_path (str or None): A string path for the settings file.

Creates a config file with the path provided or in the current folder witht he default name.

from_file

  • string_path (str or None): A string path for the settings file.

Reads the file provided, and creates a settings class.

WebCLIServer

  • settings: Settings data to set up the server.
  • backend: A func that can handle UserCommand data class as input, and do something with it, with a return value that's ignored.
  • logger: An smdb_logger logger. It can be None or ignored, so it won't produce output on stdrout.

functions

push_data

  • response (str or List[str]): The output for a user command.
  • command (UserCommand or None): The user command to reply to. If None, the last command will be used.

Adds a response for a user command. It can be used to oush data to the web cli, with command being not set, it will result in the data being pushed to the last command in the history.

start

Starts the server.

stop

Stops the server.

Project details


Download files

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

Source Distribution

smdb_web_interface-0.1.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

smdb_web_interface-0.1.5-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file smdb_web_interface-0.1.5.tar.gz.

File metadata

  • Download URL: smdb_web_interface-0.1.5.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for smdb_web_interface-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b67f96b313770280c92481d9bbd4bb5b9f9ae4869c128ad948e993c23159a157
MD5 0d52778a911fb72b2f16a06c817053f4
BLAKE2b-256 ff16c53eae04d13b8266f796b8920df3b2dc38c9695cbe986ac330b0318d40c8

See more details on using hashes here.

File details

Details for the file smdb_web_interface-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for smdb_web_interface-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5239e33d8c2725928c17e88bc4420e23b06b5b69df5ecdbcc9562039b655f924
MD5 17c79795b8a791c541746bdfa693d124
BLAKE2b-256 8f2d823910c645c75b3076a6cf525576d9c35d2b65fd4e297dae0951b881d4de

See more details on using hashes here.

Supported by

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