From f8c51bdfd8d1b55e4b623ac5341284365e54d601 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 26 Dec 2018 02:05:56 -0800 Subject: fetch_url: fix cookie sending/receiving not working --- youtube/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'youtube/common.py') diff --git a/youtube/common.py b/youtube/common.py index 0a53c51..655f24c 100644 --- a/youtube/common.py +++ b/youtube/common.py @@ -169,12 +169,12 @@ def fetch_url(url, headers=(), timeout=15, report_text=None, data=None, cookie_j start_time = time.time() req = urllib.request.Request(url, data=data, headers=headers) - if cookie_jar_send: + if cookie_jar_send is not None: cookie_jar_send.add_cookie_header(req) response = urllib.request.urlopen(req, timeout=timeout) response_time = time.time() - if cookie_jar_receive: + if cookie_jar_receive is not None: cookie_jar_receive.extract_cookies(response, req) content = response.read() -- cgit v1.2.3