import tornado.web
import tornado.ioloop

class basicRequestHandler(tornado.web.RequestHandler):
    def get(self):
        self.set_header("Access-Control-Allow-Origin", "gcp-public-data-landsat.storage.googleapis.com")
        self.write(f"Served successfully.")

    def options(self):
        self.set_header("Access-Control-Allow-Origin", "gcp-public-data-landsat.storage.googleapis.com")
        self.set_header("Access-Control-Allow-Headers", "Content-Type")
        self.set_status(204)
        self.finish()

if __name__ == "__main__":
    app = tornado.web.Application([
        (r"/", basicRequestHandler)
    ])
    port = 8888
    app.listen(port)
    print(f"Application is ready and listening on port {port}.")
    tornado.ioloop.IOLoop.current().start()