Skip to main content

Posts

Showing posts from June, 2020

using python tornado skeleton

import time import tornado.ioloop import tornado.web from tornado import gen, concurrent import json class MainHandler ( tornado . web . RequestHandler ): # @gen.coroutine # def get(self): # l = ['Ram', 'Shyam', 'Sita', 'Lakshman'] # v = random.choice(l) # yield self.write("Hello, world --> " + v) @gen.coroutine # @concurrent.run_on_executor(executor='_thread_pool') def post ( self ): print ( self ) # req_data = (json.loads(self.request.body)) print ( self .request.body) req_data = (json.loads( self .request.body.decode( 'utf-8' ))) # # print("inside the post request") channelID = req_data[ "channelId" ] print ( "channelid :" + channelID) self .set_header( "Content-Type" , "text/plain" ) yield self .write(channelID) def make_app (): return to