From 7c5206a130ac2fabaf254e20f63240155df52f68 Mon Sep 17 00:00:00 2001 From: Aidan Holland Date: Fri, 3 Nov 2017 12:59:11 -0400 Subject: [PATCH 1/2] Update blazy.py Forgot to import urllib2.URLError for error handling on line 46 --- blazy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blazy.py b/blazy.py index 52e4639..933ff6a 100644 --- a/blazy.py +++ b/blazy.py @@ -7,6 +7,7 @@ import sys from bs4 import BeautifulSoup from re import search, findall from urllib import urlopen +from urllib2 import URLError #Stuff related to Mechanize browser module br = mechanize.Browser() #Shortening the call by assigning it to a varaible "br" # set cookies @@ -42,7 +43,7 @@ else: url = 'http://' + url try: br.open(url) #Opens the url -except urllib2.URLError as e: +except URLError as e: url = 'https://' + url br.open(url) forms = br.forms() #Finds all the forms present in webpage From bb03a8b52e8c908555764543d24228a511276824 Mon Sep 17 00:00:00 2001 From: Aidan Holland Date: Fri, 3 Nov 2017 13:02:42 -0400 Subject: [PATCH 2/2] Update blazy.py Added timeout --- blazy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blazy.py b/blazy.py index 933ff6a..362ceff 100644 --- a/blazy.py +++ b/blazy.py @@ -42,7 +42,7 @@ elif 'https://' in url: else: url = 'http://' + url try: - br.open(url) #Opens the url + br.open(url, timeout=10.0)) #Opens the url except URLError as e: url = 'https://' + url br.open(url)