From 9d1155955ec6ab4cdbcd045128f5c50b4de85326 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 10 Dec 2014 11:29:05 +0100 Subject: [PATCH] correctly fix the problem with streamed calls on requests (closes #1683) Do not close explicitly the socket, as it is closed automatically when all the data is consumed. --- modules/canalplus/browser.py | 1 - modules/francetelevisions/browser.py | 1 - weboob/applications/videoob/videoob.py | 6 ++---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/canalplus/browser.py b/modules/canalplus/browser.py index fd06e89c..0ce8647c 100644 --- a/modules/canalplus/browser.py +++ b/modules/canalplus/browser.py @@ -80,7 +80,6 @@ class CanalplusBrowser(Browser): def read_url(self, url): r = requests.get(url, stream=True) buf = r.iter_lines() - r.close() return [line for line in buf if not line.startswith('#')] def iter_resources(self, split_path): diff --git a/modules/francetelevisions/browser.py b/modules/francetelevisions/browser.py index 5ef4cff7..b7a6cb60 100644 --- a/modules/francetelevisions/browser.py +++ b/modules/francetelevisions/browser.py @@ -47,7 +47,6 @@ class PluzzBrowser(PagesBrowser): def read_url(self, url): r = self.open(url, stream=True) buf = r.iter_lines() - r.close() return buf def latest_videos(self): diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index 5968f540..7b3e8c5b 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -121,10 +121,8 @@ class Videoob(ReplApplication): os.spawnlp(os.P_WAIT, args[0], *args) def read_url(self, url): - r = requests.get(url, stream=False) - buf = r.iter_lines() - r.close() - return buf + r = requests.get(url, stream=True) + return r.iter_lines() def complete_download(self, text, line, *ignored): args = line.split(' ')