Skip to content

Commit

Permalink
Backward compability
Browse files Browse the repository at this point in the history
  • Loading branch information
soachishti committed Oct 18, 2017
1 parent 3aed95f commit 6f4898e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mosspy/download_report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from bs4 import BeautifulSoup
from threading import Thread
import logging
import os
Expand All @@ -8,6 +7,8 @@
from urllib2 import urlopen

def process_url(url, urls, base_url, path):
from bs4 import BeautifulSoup # Backward compability, don't break Moss when bs4 not available.

logging.debug ("Processing URL: " + url)
response = urlopen(url)
html = response.read()
Expand Down
3 changes: 3 additions & 0 deletions mosspy/moss.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def send(self):
return response.decode().replace("\n","")

def saveWebPage(self, url, path):
if len(url) == 0:
raise Exception("Empty url supplied")

response = urlopen(url)
content = response.read()

Expand Down

0 comments on commit 6f4898e

Please sign in to comment.