def calibrate(self, data_type, data):
     response = Response(200)
     main.calibrate(data)
     response.add_body(content_type['text'], '1')
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
 def move(self, data_type, data):
     response = Response(200)
     if (data == 'start'):
         main.goToStart()
     response.add_body(content_type['text'], '1')
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
 def auto_move(self):
     print('Running program')
     response = Response(200)
     data = main.run()
     response.add_body(content_type['json'], json.dumps(data))
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
 def fetch_image(self):
     print('Fetching image')
     response = Response(200)
     main.getCameraImage()
     response.add_body(content_type['text'], '1')
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
 def set_field(self, data_type, data):
     response = Response(200)
     value = '0'
     if main.setFieldTemplate(map(int, data.split(","))):
         value = '1'
     response.add_body(content_type['text'], value)
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
 def init(self):
     print('Initializing...')
     response = Response(200)
     value = '0'
     if main.init():
         print "Found field, returning 1"
         value = '1'
     response.add_body(content_type['text'], value)
     response.add_header("Access-Control-Allow-Origin",
                         "http://localhost:8000")
     return response
def some_day():
    print('I like trains')

    return Response(status_code=200, message="train")