smdb-web-interface


Namesmdb-web-interface JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/NightKey/web-cli
SummaryAn easy to use Web interface for python application.
upload_time2024-03-11 10:46:22
maintainer
docs_urlNone
authorJanthó Dávid
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Web-CLI
Easy to use Web CLI for python applications.

# Table of content
 - [Usage](#usage)
 - [Settings](#settings)
 - [WebCLIServer](#webcliserver)

# Usage
Import and make a instantiate it. 
```python
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().

```python
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NightKey/web-cli",
    "name": "smdb-web-interface",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Janth\u00f3 D\u00e1vid",
    "author_email": "davidjantho@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ff/16/c53eae04d13b8266f796b8920df3b2dc38c9695cbe986ac330b0318d40c8/smdb_web_interface-0.1.5.tar.gz",
    "platform": null,
    "description": "# Web-CLI\r\nEasy to use Web CLI for python applications.\r\n\r\n# Table of content\r\n - [Usage](#usage)\r\n - [Settings](#settings)\r\n - [WebCLIServer](#webcliserver)\r\n\r\n# Usage\r\nImport and make a instantiate it. \r\n```python\r\nsettings = Settings(name=\"Example page\")\r\nserver = WebCLIServer(settings, backend)\r\n\r\nfun backend(user_command: UserCommand) -> None:\r\n    # do stuff here\r\n```\r\n\r\nAfter, start the server with server.start().\r\n\r\n```python\r\nserver.start()\r\n```\r\n\r\nThe 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.\r\n\r\n# Settings\r\n - host: Host's IP.\r\n - port: Port for the IP address.\r\n - name: Name of the web server.\r\n\r\n## functions\r\n\r\n### to_file\r\n - string_path (str or None): A string path for the settings file.\r\n\r\nCreates a config file with the path provided or in the current folder witht he default name. \r\n\r\n### from_file\r\n - string_path (str or None): A string path for the settings file.\r\n\r\nReads the file provided, and creates a settings class.\r\n\r\n# WebCLIServer\r\n - settings: Settings data to set up the server.\r\n - backend: A func that can handle UserCommand data class as input, and do something with it, with a return value that's ignored.\r\n - logger: An smdb_logger logger. It can be None or ignored, so it won't produce output on stdrout.\r\n\r\n## functions\r\n\r\n### push_data\r\n - response (str or List[str]): The output for a user command.\r\n - command (UserCommand or None): The user command to reply to. If None, the last command will be used.\r\n\r\nAdds 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.\r\n\r\n### start\r\nStarts the server.\r\n\r\n### stop\r\nStops the server.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An easy to use Web interface for python application.",
    "version": "0.1.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/NightKey/web-cli/issues",
        "Homepage": "https://github.com/NightKey/web-cli"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f2d823910c645c75b3076a6cf525576d9c35d2b65fd4e297dae0951b881d4de",
                "md5": "17c79795b8a791c541746bdfa693d124",
                "sha256": "5239e33d8c2725928c17e88bc4420e23b06b5b69df5ecdbcc9562039b655f924"
            },
            "downloads": -1,
            "filename": "smdb_web_interface-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17c79795b8a791c541746bdfa693d124",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 13611,
            "upload_time": "2024-03-11T10:46:20",
            "upload_time_iso_8601": "2024-03-11T10:46:20.451572Z",
            "url": "https://files.pythonhosted.org/packages/8f/2d/823910c645c75b3076a6cf525576d9c35d2b65fd4e297dae0951b881d4de/smdb_web_interface-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff16c53eae04d13b8266f796b8920df3b2dc38c9695cbe986ac330b0318d40c8",
                "md5": "0d52778a911fb72b2f16a06c817053f4",
                "sha256": "b67f96b313770280c92481d9bbd4bb5b9f9ae4869c128ad948e993c23159a157"
            },
            "downloads": -1,
            "filename": "smdb_web_interface-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "0d52778a911fb72b2f16a06c817053f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14193,
            "upload_time": "2024-03-11T10:46:22",
            "upload_time_iso_8601": "2024-03-11T10:46:22.335070Z",
            "url": "https://files.pythonhosted.org/packages/ff/16/c53eae04d13b8266f796b8920df3b2dc38c9695cbe986ac330b0318d40c8/smdb_web_interface-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 10:46:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NightKey",
    "github_project": "web-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "smdb-web-interface"
}
        
Elapsed time: 0.38125s