def doIt(uri):
    cj = cookielib.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
page = opener.open(uri)
page.addheaders = [('User-agent', 'Mozilla/5.0')]
print(page.read())
for i in sys.argv[1:]:
    doIt(i)
How to use Python requests to fake a browser visit?