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.6.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

smdb_web_interface-0.1.6-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smdb_web_interface-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7af6f475677251697aa6346c72a10c5e2728a6be4cf9378609f37f99fd0fc830
MD5 4bf26b406f13b27a5aa17db36a4c8ab5
BLAKE2b-256 1b7b57c7354f95327aa895d73cd60d287fea1ecaf2ebf96890ba5d714f0554e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smdb_web_interface-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7d9abf038d148cd37f408a1efc8589a8f6ade4741380f61305e8c3a36d55f1c8
MD5 2d8d760bbdb449b9e2c9b13567c241b4
BLAKE2b-256 54c2dd122dd67321604983929af008bed48684e2b23976632cfd42eadba276d3

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