Consuming HTTP Services in Python Transcripts
Chapter: Accessing authenticated HTTP services
Lecture: Concept: Adding authentication to requests

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Now you've seen how to use requests to access restricted authorization requiring services,
0:10 so what we have to pass is that authorization header with the basic value set to the basic c4 encoded version of username:password,
0:19 but remember, it's not encrypted, it's just obscured, so how does this work, of course, everything more or less is the same,
0:26 other than the authentication, so we import request, we come up with the url, we try to do a get against the service and we saw oh 401, not so amazing,
0:34 401 is you didn't log in, you are unauthorized, right, so we just go and set the auth as a tuple, username,password,
0:44 and then ta- da, everything is 200 ok.


Talk Python's Mastodon Michael Kennedy's Mastodon