Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add HTTP Request command #78

Closed
leo-schick opened this issue May 23, 2022 · 3 comments
Closed

add HTTP Request command #78

leo-schick opened this issue May 23, 2022 · 3 comments
Labels
Milestone

Comments

@leo-schick
Copy link
Member

I plan to add a new HttpRequestCommand which shall run a HTTP/HTTPS command via curl.

It should keep the output clean (using option -s) and fail when the request returns an error code (option -f).

Things to implement

  • support different request types (arg -X), using GET requests by default
  • support passing headers (option -H)
  • implement a command which generates the shell command string with an option to pass data from stdin (option --data-binary @-)

Possible use cases

  • calling an API function with an access token
  • running a serverless cloud function (AWS Lambda / Google Cloud Function / Azure Function command) via HTTP request

How to implement

  • add a new function http_request_command(...) in mara_pipelines.shell
  • add a new command HttpRequestCommand in mara_pipelines.commands.http
@leo-schick
Copy link
Member Author

@jankatins any comments about the design?

@jankatins
Copy link
Member

I always did that directly via curl or python, so sounds fine.

I've not yet a clue on the stdin thingy, how would you use that?

@leo-schick
Copy link
Member Author

I build a cloud function which validates a XML file against a schema and converts it to json. To process this logic through files in a directory the shell command would look roughly like this:

shell_command = f"{mara_storage.shell.read_file_command(...) \\\n" \
                f"  | {mara_pipelines.shell.http_request_command(...)} \\\n" \
                f"  | {mara_storage.shell.write_file_command(..)"

leo-schick added a commit that referenced this issue May 23, 2022
leo-schick added a commit that referenced this issue Sep 26, 2022
@leo-schick leo-schick added this to the Version 3.4.0 milestone Sep 26, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants