Git Product home page Git Product logo

click-web's People

Contributors

fredrik-corneliusson avatar jaybigguy10 avatar mareksimunek avatar whatang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

click-web's Issues

web_click_types.py isn't getting executed

as seen here EMAIL_TYPE = EmailParamType() needs to be executed in the users program as this is what allows the user to select EMAIL_TYPE as an input type

this is because web_click_types is only being imported by input_feilds

some part of the click web program needs to set this variable

Add script exit status information to rawcmd output.

In web the exit status of the command is communicated.
Add a json object with information on exit status to last line in the rawoutput response text.

Examples:
for OK:
{"result": "OK", "returncode": 0, "message": "Done"}
for ERROR:
{"result": "ERROR", "returncode": 2, "message": "Script exited with error code: 2"}

Update README and add example on how to use typer with click-web

Hey!

I just found this project and really like the idea. Now I already had a tool written in typer and not click.
However typer is based on click so it is possible to use this tool with typer!

It would be nice to update the README and inform users that they can use typer with this tool and maybe add an example in the repo. The get_command function from typer generates a click command group and the only requirement to make it work with click-web is to set the name variable.

Take your Typer() instance and do the following

commands.py

import typer

typer_app = typer.Typer()

main.py

from click_web import create_click_web_app
import commands
import typer

typer_app = typer.Typer()

cmd = typer.main.get_command(commands.typer_app)
cmd.name = "cli"
app = create_click_web_app(commands, cmd)

start.sh

export FLASK_ENV=development
export FLASK_APP=app.py
flask run

Scripts does not run when serving flask-app behind uwsgi

Now running scripts depends on sys.executable beeing the same python interpreter (and venv) as flask is running as.
This does not work when running behind uwsgi as sys.executable points to uwsgi binary.
Fallback to use the python interpreter in the venv that uwsgi is configured with.

Add simple raw API to make commands easier to call from scripts

In some cases it is useful to call the server endpoints via simple scripts or curl without a web ui.
The current HTML form post API not suitable for this.
So implement a simple way to run the command as raw text in a form post.
Example
curl --request POST --url http://127.0.0.1:5000/_rawcmd --header 'Content-Type: text/plain' --data 'print-lines 5 --delay 1 --message Red'

The API is then very similar to how the click command would have been run on command line.
Note: In order for this to work some more advanced features will not be supported such as file upload/download.

syntaxerror: flask_app.logger.info

I got this following error when trying to run example_command, anyone have any idea?

File "/home/andrew/.virtualenvs/example/lib/python3.5/site-packages/click_web/__init__.py", line 59
    _flask_app.logger.info(f'OUTPUT_FOLDER: {OUTPUT_FOLDER}')
                                                           ^
SyntaxError: invalid syntax

Allowing click-web to safely process uploaded files

Hello,

Thank you for this repo. In this issue it is mentioned that "Providing a text input [to click-web] would not work unless you are on the same machine and it would be a dangerous vulnerability if you can make scripts process any folder on the server from the web." Is there a recommended way to safely allow the uploading and processing of files such as images using click-web?

Thanks.

Unable to use directories as input to `click.Path(file_okay=False, dir_ok=True)`

The file picker (at least on Firefox/Ubuntu 18.08) doesn't allow choosing a directory, which is probably due to there not being a web API for it. A workaround might be to show a text input as a fallback which is not ideal but I don't know that there's really a good solution here due to the limitations of the web platform.

Add click-web functionality to an existing app

Hello,

Would you have any advice for someone trying to adapt the click-web functionality so that they could add the command routes to a website and not create an entirely new server for it?

I am trying to add it to a flask app that also has a cli where I would like to allow users to execute cli commands from the web interface, just like this project :).

I'm trying to read through the code, but would you have any pointers or tips?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.