For day to day work in dev-ops or for testing team , we need to put stub in between some application to fill the gap for the application which are not present on local testing lab , for that we need to put some stub so that it can mimic like actual application . We will discuss one tool here which eventually make tester and developer life very easy , The cherrypy library of python. I will write simplest code example to create HTTP server , which takes json payload in POST request and also send the json response in reply. Sample request Payload 'http://127.0.0.1:9990/context' '{"tid": "11000098777","deviceid": "9000002020020202"}' Response from server { : } RESULT "ACCEPTED" Sample code for above requirement in python Instillation steps For installing cherrypy you need to use pip utility and can install cherrypy pip install cherrypy Server.py cherrypy os.path configparser json = open( ) f: self.response_json_object = json.load(f) @cherrypy.expose() @cherrypy.tools.json_in() @cherrypy.tools.json_out() def context(self): self.response_json_object configfile=os.path.join(os.path.dirname(__file__), ) cherrypy.quickstart(Server(), , config=configfile) import import import import ( ): ( ): . class Server object def __init__ self self response_json_objectresponse_json_object '' with './response.json' as return './server.conf' '/' Above program is using one config file named server.conf Also it is reading one json file which will be send as json response for the incoming request. server.conf [global] server.socket_host = server.socket_port = server.thread_pool= tools.staticdir.on = False tools.staticdir.dir = log.access_file = log.error_file = log.screen = False tools.sessions.on = True '127.0.0.1' 9990 10 "./logs/access1.log" "./logs/error1.log" response.json { : } RESULT "ACCEPTED" On Linux terminal you can use below command to run the program Start the application paython Server.py & Test the application curl -i -X POST -H --data "Content-Type:application/json" 'http://127.0.0.1:9990/context' '{"tid": "11000098777","deviceid": "9000002020020202"}' { : } RESULT "ACCEPTED"