Requests was written to make HTTP requests very simple and human-readable. In simple terms, it lets us visit a web address directly in Python code instead of having to use a browser. This also gives us back the data returned from the server, meaning we can make use of it in our Python code.
We can use requests to grab data back from our flask web service and use it in some Python code. We will begin with a small demo script which will make use of the data which is being returned from our index function.
First things first; we need to install the requests module via pip. Make sure your virtual environment is sourced and run pip install requests in your command line.