Consuming HTTP Services in Python Transcripts
Chapter: Accessing authenticated HTTP services
Lecture: Concept: Authenticated requests with Python 3's urllib.requests
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Let's look at the concepts behind authenticated basic auth request with urllib, so again, we import urllib.request, this is the Python 3 version,
0:11
we have our url, and what we did is globally, one time we ran this code, we said we want to set up a password manager,
0:19
so an http password manager with default realm and then, we came along and added a password, no realm register the base url,
0:28
and said kennedy and super_lockdown, those are the username and the password, and we created an http basic auth handler with that password manager,
0:36
and then we created an opener based on that handler, and finally, we installed that opener,
0:43
and then any time there was a request going to that url through urllib, it used this authenticated http basic auth handler that we had registered here.
0:52
We compose this and globally install it and it's done, so that is kind of nice, but, it seems like there should be a simpler way to do this huh?