Question 30
Consider the following resource "TestAPI" created using flask-restful which is running locally on http://127.0.0.1:5000 and answer the given subquestions.
parser = reqparse.RequestParser()parser.add_argument('movie')parser.add_argument('genre')
r_fields = {"film":fields.String(attribute = 'movie')}
class TestAPI(Resource):# =============================================# GET-FUNCTION# =============================================# =============================================# POST-FUNCTION def post(self, genre): return {'Genre': genre}# ============================================= @marshal_with(r_fields) def put(self): this_film = parser.parse_args() return this_film
api.add_resource(TestAPI, "/api/v1", "/api/v1/<genre>")If the curl request shown below.
curl http://127.0.0.1:5000/api/v1 -X GET -d "{\"movie\" : \"X-men\",\"genre\": \"Action\"}" -H "Content-Type: application/json"retrieves the movie only with status 200 OK, what will come in place of GET-FUNCTION in the code?