1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-21 23:33:10 +00:00

[heartbeat] python2: remove explicit http method

This commit is contained in:
insaneracist 2020-11-03 14:41:27 -08:00
parent 89ada4406a
commit 12ab8cf6c5
2 changed files with 4 additions and 4 deletions

View file

@ -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,
}

View file

@ -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)