flask restful arguments in url

Solutions on MaxInterview for flask restful arguments in url by the best coders in the world

showing results for - "flask restful arguments in url"
Louane
26 Apr 2019
1from flask import Flask, request
2from flask_restful import Api, Resource
3
4app = Flask(__name__)
5api = Api(app)
6
7# Flask mishandles boolean as string
8TRUTHY = ['true', 'True', 'yes']
9
10class Item(Resource):
11   def get():
12      # Get `class` list from request args
13      classes = request.args.getlist('class') 
14
15      # Get `analysis` boolean from request args
16      analysis = True if request.args.get('analysis') in TRUTHY else False
17
18api.add_resource(Item, '/item')
19