July 2019
Beginner to intermediate
302 pages
9h 38m
English
We will see how this REST interface works on the Python shell using the requests library.
The command will show following information:
>>> import requests
>>> res = requests.get('http://127.0.0.1:5000/api/product')
>>> res.json()
'This is a GET response'
>>> res = requests.post('http://127.0.0.1:5000/api/product')
'This is a POST response'
>>> res = requests.put('http://127.0.0.1:5000/api/product/1')
'This is a PUT response'
>>> res = requests.delete('http://127.0.0.1:5000/api/product/1')
'This is a DELETE response'
In the preceding snippet, we ...