def test_downloader_resp_headers(self):
with open('mpdstub/mpd/17875351285037717.mpd', 'r') as f:
mpd_content = f.read()
with responses.RequestsMock(assert_all_requests_are_fired=True) as rsps:
rsps.add(responses.GET, self.TEST_MPD_URL, body=mpd_content)
rsps.add(responses.GET, self.TEST_MPD_URL, body=mpd_content,
headers={'Cache-Control': 'max-age=1'})
rsps.add(responses.GET, self.TEST_MPD_URL, body=mpd_content,
headers={'X-FB-Video-Broadcast-Ended': '1'})
dl = live.Downloader(
mpd=self.TEST_MPD_URL,
output_dir='output_respheaders')
dl.run()
with responses.RequestsMock(assert_all_requests_are_fired=True) as rsps:
rsps.add(responses.GET, self.TEST_MPD_URL, body=mpd_content,
headers={'Cache-Control': 'max-age=1'})
rsps.add(responses.GET, self.TEST_MPD_URL, body=mpd_content,
headers={'Cache-Control': 'max-age=1000'})
dl = live.Downloader(
mpd=self.TEST_MPD_URL,
output_dir='output_respheaders')
dl.run()
# Can't stitch and check for output because responses does not support
# url pass through, so the segments cannot be downloaded.
test_live.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录