Authentication mechanisms with Python

The authentication mechanisms supported natively in the HTTP protocol are HTTP Basic and HTTP Digest. Both mechanisms are supported in Python through the requests library.

The HTTP Basic authentication mechanism is based on forms and uses Base64 to encode the user composed with the password separated by a "colon" (user: password).

The HTTP Digest authentication mechanism uses MD5 to encrypt user, key, and realm hashes. The main difference between both methods is that the Basic only encodes, without actually encrypting, while the Digest encrypts the user's information in the MD5 format.

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.