From 12ab8cf6c5ed2dcaa3f912425b25f1651861f5a6 Mon Sep 17 00:00:00 2001 From: insaneracist Date: Tue, 3 Nov 2020 14:41:27 -0800 Subject: [PATCH] [heartbeat] python2: remove explicit http method --- youtube_dlc/extractor/niconico.py | 1 - youtube_dlc/heartbeat.py | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dlc/extractor/niconico.py b/youtube_dlc/extractor/niconico.py index 6b4726bae..1c6172794 100644 --- a/youtube_dlc/extractor/niconico.py +++ b/youtube_dlc/extractor/niconico.py @@ -263,7 +263,6 @@ class NiconicoIE(InfoExtractor): 'data': json.dumps(session_response['data']), 'headers': heartbeat_headers, 'interval': session_api_data['heartbeat_lifetime'] / 2000, - 'method': 'POST', 'url': heartbeat_url, } diff --git a/youtube_dlc/heartbeat.py b/youtube_dlc/heartbeat.py index c67566963..0b0bb838c 100644 --- a/youtube_dlc/heartbeat.py +++ b/youtube_dlc/heartbeat.py @@ -18,11 +18,12 @@ class Heartbeat(object): data = params.get('data') if isinstance(data, compat_str): data = data.encode() + # Python 2 does not allow us to set HTTP method + # it is POST if Request has data, otherwise GET self.request = sanitized_Request( params.get('url'), data=data, - headers=params.get('headers', {}), - method=params.get('method') + headers=params.get('headers', {}) ) self.interval = params.get('interval', 30) @@ -49,7 +50,7 @@ class Heartbeat(object): self.ydl.to_screen('[heartbeat]') self.ydl.urlopen(self.request) except Exception: - self.ydl.report_warning("[heartbeat] Heartbeat failed") + self.ydl.report_warning("Heartbeat failed") if self.ydl.params.get('verbose'): self.ydl.to_stderr(encode_compat_str(traceback.format_exc())) self.parent_thread.join(self.interval)