dodecafonico
dodecafonico

Reputation: 305

How can I call web python script to get HTTP response value with GET?

What is the simplest way for making a Python script run in a webserver and allow me to call it passing a parameter and grabbing the value that the script ends up with?

I am thinking that this is what is normally refered to as an API, but not sure how to implement this in the most simple way.

The application from which I would be calling this python script is ManyChat, through its feature "external requests" which allows me to use GET or POST parameters, but I don't know how I would turn my python script into a web queriable api.

https://support.manychat.com/support/solutions/articles/36000018457-dev-tools-external-request-and-dynamic-block-

I took a look online and found some articles about Python + Flask but it seems a solution for scenario where SQL database is involved in the operations. However my python script will NOT need to communicate with any SQL database so I am wondering if there is a simpler solution

Upvotes: 0

Views: 110

Answers (1)

pstatix
pstatix

Reputation: 3858

Flow control could be as follows:

  • Flask app running on /api on your web server
  • Client app does requests.get('myserver.com/api?p1=v1&p2=v2')
  • Flask app handles request and runs function under @app.route('/api')
  • Client app receives response

Upvotes: 1

Related Questions