The requests module

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset