fromFlaskImportFlask fromFlaskImportrequest, Response, jsonifyImportRandomImportStringapp= Flask (__name__)defId_generator (size=20, chars=string.digits +string.ascii_letters):"""defines a"""str_="" forIinchRange (size): I=Random.choice (chars) str_+=Str (i)returnstr_defresponse (): Content='{"Result": "%s", "Data": "%s"}'%(Id_generator (4), Id_generator (9)) Resp=Response (content) resp.headers["Access-control-origin"] ='*' returnResp@app.route ("/")#Routingdefindex ():return "welcome!"#HTTP GET@app. Route ("/query", methods=["GET"])defquery ():Pass returnjsonify (username=id_generator (4), Password=id_generator (9) @app. Route ("/update", methods=["POST"])defupdate ():returnresponse () @app. Route ("/delete", methods=["Deledt"])defDelete ():returnresponse () @app. Route ("/head", methods=['HEAD'])defHead ():returnresponse ()if __name__=='__main__': App.run (Debug=true)
Temporary
Python base = = = Flask is used to implement Mock-server