Update blazy.py

Forgot to import urllib2.URLError for error handling on line 46
This commit is contained in:
Aidan Holland
2017-11-03 12:59:11 -04:00
committed by GitHub
parent 648c126673
commit 7c5206a130

View File

@@ -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