Question 25
Consider the following restful implementation using flask.
from flask import Flask, requestfrom flask_restful import Resource, Api
app = Flask(__name__)api = Api(app)
student_info = {"name": "Rahul", "Roll No":"12d2000678", "Email":"onlinedegree.iitm.ac.in"}
class Student(Resource): def put(self): data = request.json student_info.update(data) return student_info
def delete(self): student_info.popitem() return "success", 200
api.add_resource(Student, '/')
app.run()If the above application is running on “http://127.0.0.1:5000” then what will be the final output on terminal on executing these two curl commands in the order mentioned?
1: curl -X DELETE 'http://127.0.0.1:5000'
2:
curl -X PUT -H "Content-Type: application/json" -H "Accept-Type: application/json" -d '{"Roll No":"12f2000555", "Email": "ds.study.iitm.ac.in"}' 'http://127.0.0.1:5000/'