How to do it...

  1. Start with the Using the Flask framework for RESTful APIs recipe. We'll be adding a new view function to an existing web application.
  2. Define a routea URL patternto a view function that performs a specific request. This is a decorator, placed immediately in front of the function. It will bind the function to the Flask application:
        @dealer.route('/dealer/hands/') 
  1. Define a view function that responds to requests sent to the particular route:

        def multi_hand(): 
  1. Within the view function, extract the values of a unique key with the get() method or use ordinary [] syntax that is appropriate for the built-in dict type. This returns individual values without the complication of a list for the common case where the list would ...

Get Modern Python Cookbook 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.