Sending a POST request using the requests library

A new arena can be added using a web request, avoiding the need to use the HTML template. Here is a demonstration of a request using the requests library:

>>> form = {'longitude':'-109.5', 'latitude':'40.7', 'name':'Test Arena'}
>>> requests.post('http://127.0.0.1:5000/nba/api/v0.1/arena/add', form)
<Response [200]>

The POST request is sent to the '/add' endpoint, along with the required form parameters, as a Python dictionary.

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

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