From the course: Python: XML, JSON, and the Web

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using authentication

Using authentication - Python Tutorial

From the course: Python: XML, JSON, and the Web

Start my 1-month free trial

Using authentication

- [Joe] Handling authentication is another fairly common issues when working with some kinds of web services such as GitHub or Twitter or other data sources that require you to be logged in. The Requests library makes this process pretty easy for a few different kinds of web authentication such as Basic, Digest and OAuth versions one and two. In this example, we'll see how to implement Basic Authentication and again we'll use the httpbin service for that. So here on the httpbin.org you can see that there's a link for Basic Authentication testing here under the Auth section. So here is the Basic Auth, and you can see that there is Digest, and Hidden Basic, and Bearer and so on. So I'm going to try out the Basic Authentication, and the format for the URL that it uses for testing is to include the username and the password that you want to authenticate against. So I'll just set these to be you know, user123 and we'll just leave it as passwd. So let's try this out here, before we write…

Contents