How to create an HTTP endpoint with bash/Python script?

I wish to create an HTTP endpoint like: <some-IP-address>:<some-port>/<some-endpoint-name> using bash or Python script.

I will then set up a curl client to call the endpoint. The curl client waits (with timeout) for the endpoint to return a status message.

When the endpoint receives the call from the curl client, it triggers an operation. When the operation is done (completed or failed), it sends a status message back to curl.

All of this has to be done with bash or Python script. I am not sure whether this is achievable or not. I have spent quite a long time to work on this, but to no avail. It would be great if someone can shed some lights on high-level steps to implement this (code snippet is welcomed). Thanks!