I am using a flask tutorial that I found here…
https://andrewgriffithsonline.com/blog/180412-deploy-flask-api-any-serverless-cloud-platform/
In the "Test the App" section, there is a "http-prompt" command used. I do not want to use that. Instead I will like to use python requests module.
>Solution :
That’s great! Using the requests library is a common and powerful way to interact with HTTP services in Python. Here’s an example of how you could use it to test your Flask app:
import requests
response = requests.get('http://localhost:5000/predict', json={'input': 'example input'})
print(response.status_code)
print(response.json())
This code will send a GET request to the /predict endpoint of your Flask app, passing a JSON payload with the key input and the value example input. The response from the server will be stored in the response variable, and you can access the status code and response content using the status_code and json() attributes, respectively. Note that you’ll need to change ‘http://localhost:5000/predict’ to the appropriate URL for your Flask app. If your app is running on a different host or port, you’ll need to update the URL accordingly.