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

25 lines
793 B
Python
Raw Normal View History

2018-12-09 05:15:56 +00:00
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):
2019-02-16 18:16:22 +00:00
fullReplay = replayHelper.buildFullReplay(scoreID=replayID, relax=0 if replayID > 500000000 else 1)
2019-02-11 04:06:17 +00:00
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))