# do something with my_data print couleur1,couleur2,couleur3,couleur4 #self.write(json_encode(my_data)) #self.write("YO") self.finish() tinremote.takecontrol() tinremote.issuecommand( 30, couleur1+"/"+couleur2+"/"+couleur3+"/"+couleur4) # class Application(tornado.web.Application): def __init__(self): handlers = [ (r"/colors", AjaxHandler), (r"/pose", PostPose), (r"/all_category/",VersionHandler), (r"/getgamebyid/([0-9]+)", GetGameByIdHandler), (r"/user/", User) ] settings = dict( #autoescape=None, ) tornado.web.Application.__init__(self, handlers, **settings) if __name__ == "__main__": tornado.options.parse_command_line() http_server = tornado.httpserver.HTTPServer(Application()) tinremote.connect('127.0.0.1', '1234') http_server.listen(options.port) tornado.ioloop.IOLoop.current().start()
import tornado.ioloop import tornado.web import tinremote class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") tinremote.takecontrol() tinremote.issuecommand( 23, "blue" ) application = tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": application.listen(8888) tinremote.connect( 'host', 'text' ) tornado.ioloop.IOLoop.current().start() tinremote.disconnect()
# self.write(json_encode(my_data)) # self.write("YO") self.finish() tinremote.takecontrol() tinremote.issuecommand(30, couleur1 + "/" + couleur2 + "/" + couleur3 + "/" + couleur4) # class Application(tornado.web.Application): def __init__(self): handlers = [ (r"/colors", AjaxHandler), (r"/InitialPose", PostPose), (r"/Experiment", Experience), (r"/all_category/", VersionHandler), (r"/getgamebyid/([0-9]+)", GetGameByIdHandler), (r"/user/", User), ] settings = dict( # autoescape=None, ) tornado.web.Application.__init__(self, handlers, **settings) if __name__ == "__main__": tornado.options.parse_command_line() http_server = tornado.httpserver.HTTPServer(Application()) tinremote.connect("127.0.0.1", "1234") http_server.listen(options.port) tornado.ioloop.IOLoop.current().start()