Reformat, add notifications and errors.

Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
Arun Prakash Jana 2016-03-25 13:32:43 +05:30
parent b5f066ba43
commit e8835504ff

7
buku
View File

@ -147,7 +147,9 @@ def getPageResp(url, redir=False):
url = url.replace(" ", "%20")
else:
url = unquote(url)
print("unquote: %s" % url)
if debug:
print("unquoted: %s" % url)
if url.find("https://") >= 0: # Secure connection
server = url[8:]
@ -166,6 +168,7 @@ def getPageResp(url, redir=False):
server = server[:marker]
urlconn = HTTPConnection(server, timeout=30)
else:
print("\x1b[1mWARNING:\x1b[21m Not a valid HTTP(S) url")
return (None, None)
if debug:
@ -207,7 +210,7 @@ def fetchTitle(url):
# break same URL redirection loop
if url == redirurl:
print("\x1b[1mERROR:\x1b[21m Detected repeated reirection to same URL")
print("\x1b[1mERROR:\x1b[21m Detected repeated redirection to same URL")
break
url = redirurl