Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import eventlet
eventlet.monkey_patch()
from six.moves import urllib
full_url = 'https://www.wikipedia.org'
password_man = urllib.request.HTTPPasswordMgrWithDefaultRealm()
password_man.add_password(None, full_url, 'user', 'password')
auth_handler = urllib.request.HTTPBasicAuthHandler(password_man)
opener = urllib.request.build_opener(auth_handler)
req = urllib.request.Request(full_url)
#import pdb; pdb.set_trace()
resp = opener.open(req)
print(resp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment