import tornado.gen
import tornado.web
from common.web import requestsManager
from constants import exceptions
from helpers import replayHelper
from common.sentry import sentry
MODULE_NAME = "get_full_replay"
class handler(requestsManager.asyncRequestHandler):
"""
Handler for /replay/
@tornado.web.asynchronous
@tornado.gen.engine
@sentry.captureTornado
def asyncGet(self, replayID):
fullReplay = replayHelper.buildFullReplay(scoreID=replayID, relax=0 if replayID > 500000000 else 1)
self.write(fullReplay)
self.add_header("Content-type", "application/octet-stream")
self.set_header("Content-length", len(fullReplay))
self.set_header("Content-Description", "File Transfer")
self.set_header("Content-Disposition", "attachment; filename=\"{}.osr\"".format(replayID))