Improve error handling a little.
This commit is contained in:
parent
79f945800e
commit
cfe3ef63a0
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import pycurl
|
import pycurl
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from utils import notify,debug
|
from utils import notify,debug,error
|
||||||
|
|
||||||
# args should be a dictionary of arguments
|
# args should be a dictionary of arguments
|
||||||
# return page bytes, response code
|
# return page bytes, response code
|
||||||
|
@ -21,7 +21,11 @@ def download (platform, url, args, verbosity, return_http_code=False):
|
||||||
# c.setopt(pycurl.CIPHERS, args["ciphers"]
|
# c.setopt(pycurl.CIPHERS, args["ciphers"]
|
||||||
|
|
||||||
notify ("Downloading " + url + "...", verbosity, platform)
|
notify ("Downloading " + url + "...", verbosity, platform)
|
||||||
|
try:
|
||||||
c.perform()
|
c.perform()
|
||||||
|
except pycurl.error as e:
|
||||||
|
error (str(e), verbosity, platform)
|
||||||
|
return None
|
||||||
response_code = c.getinfo(c.RESPONSE_CODE)
|
response_code = c.getinfo(c.RESPONSE_CODE)
|
||||||
c.close()
|
c.close()
|
||||||
debug (url + " downloaded!", verbosity, platform)
|
debug (url + " downloaded!", verbosity, platform)
|
||||||
|
|
|
@ -73,6 +73,9 @@ for url in sys.argv[arg_count+1:]:
|
||||||
elif network:
|
elif network:
|
||||||
from download_page import download
|
from download_page import download
|
||||||
page = download (None, url, args, verbosity)
|
page = download (None, url, args, verbosity)
|
||||||
|
if page is None:
|
||||||
|
error ("Failed to download " + url, verbosity)
|
||||||
|
continue
|
||||||
|
|
||||||
# try to get feed for common software like PeerTube
|
# try to get feed for common software like PeerTube
|
||||||
debug ("Attempting to determine software from page...", verbosity)
|
debug ("Attempting to determine software from page...", verbosity)
|
||||||
|
|
Loading…
Reference in New Issue