Flask-Shell2HTTP icon indicating copy to clipboard operation
Flask-Shell2HTTP copied to clipboard

[New Feature] intercepting arguments before command execution

Open eshaan7 opened this issue 2 years ago • 2 comments

Discussed in https://github.com/eshaan7/Flask-Shell2HTTP/discussions/56

Originally posted by tomvanderputte November 6, 2023 Is it possible to intercept and change the dynamic arguments before the command is triggered? The reason is: the arguments point to input/output files in a certain location. The application that sends the POST requests is not aware of this location (nor do I want it to be), so it sends only the filename.

So I want to edit the arguments/parameters to predfix the sent arguments with the correct path. How could I achieve this?

eshaan7 avatar Nov 10 '23 21:11 eshaan7

Supposedly the "args" should be available in the context parameter within the callback function, but when accessed using

def list_wallets(context, future):
  print(context) #nothing is printed out here

This is the sole reason why I had to drop this whole thing, I had to do my own solution from scratch (since I am not a python developer)

reinaldoacosta avatar Feb 08 '25 18:02 reinaldoacosta

Hi, @reinaldoacosta. Please look at this example on how to pass data in request to make it available in the callback's context variable. On the other hand, for intercepting arguments before command execution, you can use this pattern.

eshaan7 avatar Apr 17 '25 08:04 eshaan7