This repository has been archived on 2022-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
lets/handlers/getFullReplayHandler.py
2019-02-16 13:16:22 -05:00

25 lines
793 B
Python

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))