Created
September 22, 2014 17:58
-
-
Save tab1293/8ca3eb79eb30244e4523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application = tornado.web.Application([ | |
(r"/test/(.*?)", StaticTrackHandler, {"path": "/home/ubuntu/echostream/tracks"}), | |
], debug=True) | |
class StaticTrackHandler(tornado.web.StaticFileHandler): | |
@classmethod | |
def get_current_user(self): | |
return self.get_secure_cookie('user') | |
@classmethod | |
def get_content(self, abspath, start=None, end=None): | |
if self.current_user: | |
r = requests.get('https://s3.amazonaws.com/echostream-tracks/587b3e4e2a274a06b3b18ce42674af72', stream=True) | |
return r.iter_lines() | |
else: | |
self.redirect('/login') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment