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.
This commit is contained in:
parent
ed4e1a058c
commit
9d1155955e
3 changed files with 2 additions and 6 deletions
|
|
@ -80,7 +80,6 @@ class CanalplusBrowser(Browser):
|
||||||
def read_url(self, url):
|
def read_url(self, url):
|
||||||
r = requests.get(url, stream=True)
|
r = requests.get(url, stream=True)
|
||||||
buf = r.iter_lines()
|
buf = r.iter_lines()
|
||||||
r.close()
|
|
||||||
return [line for line in buf if not line.startswith('#')]
|
return [line for line in buf if not line.startswith('#')]
|
||||||
|
|
||||||
def iter_resources(self, split_path):
|
def iter_resources(self, split_path):
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ class PluzzBrowser(PagesBrowser):
|
||||||
def read_url(self, url):
|
def read_url(self, url):
|
||||||
r = self.open(url, stream=True)
|
r = self.open(url, stream=True)
|
||||||
buf = r.iter_lines()
|
buf = r.iter_lines()
|
||||||
r.close()
|
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
def latest_videos(self):
|
def latest_videos(self):
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,8 @@ class Videoob(ReplApplication):
|
||||||
os.spawnlp(os.P_WAIT, args[0], *args)
|
os.spawnlp(os.P_WAIT, args[0], *args)
|
||||||
|
|
||||||
def read_url(self, url):
|
def read_url(self, url):
|
||||||
r = requests.get(url, stream=False)
|
r = requests.get(url, stream=True)
|
||||||
buf = r.iter_lines()
|
return r.iter_lines()
|
||||||
r.close()
|
|
||||||
return buf
|
|
||||||
|
|
||||||
def complete_download(self, text, line, *ignored):
|
def complete_download(self, text, line, *ignored):
|
||||||
args = line.split(' ')
|
args = line.split(' ')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue