from bs4 import BeautifulSoup import urllib.request def make_soup(url): thepage = urllib.request.urlopen(url) #req = Request(url, headers={\'User-Agent\': \'Moz