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.

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.