Image download wasn't working anymore

This commit is contained in:
Ruud
2014-01-11 00:05:02 +01:00
parent c15dd2dec9
commit 07c7171fbb
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -117,7 +117,7 @@ class Plugin(object):
return False
# http request
def urlopen(self, url, timeout = 30, data = None, headers = None, files = None, show_error = True):
def urlopen(self, url, timeout = 30, data = None, headers = None, files = None, show_error = True, return_raw = False):
url = urllib2.quote(ss(url), safe = "%/:=&?~#+!$,;'@()*[]")
if not headers: headers = {}
@@ -162,7 +162,7 @@ class Plugin(object):
log.info('Opening url: %s %s, data: %s', (method, url, [x for x in data.iterkeys()] if isinstance(data, dict) else 'with data'))
response = r.request(method, url, verify = False, **kwargs)
data = response.text
data = response.content if return_raw else response.text
self.http_failed_request[host] = 0
except IOError:
+1 -1
View File
@@ -93,7 +93,7 @@ class FileManager(Plugin):
return dest
try:
filedata = self.urlopen(url, **urlopen_kwargs)
filedata = self.urlopen(url, return_raw = True, **urlopen_kwargs)
except:
log.error('Failed downloading file %s: %s', (url, traceback.format_exc()))
return False