def download_transcript(self, request, _suffix=''):
"""
Download a transcript.
Arguments:
request (webob.Request): Request to handle.
suffix (string): Slug used for routing.
Returns:
File with the correct name.
"""
trans_path = self.get_path_for(request.query_string)
filename = self.get_file_name_from_path(trans_path)
transcript = requests.get(request.host_url + request.query_string).text
response = Response(transcript)
headerlist = [
('Content-Type', 'text/plain'),
('Content-Disposition', 'attachment; filename={}'.format(filename))
]
response.headerlist = headerlist
return response
评论列表
文章目录