Sometimes a web page is not open to the public, but protected in some way. The most basic aspect is to use basic HTTP authentication, which is integrated into virtually every web server, and it's a user/password schema.
Accessing password-protected pages
Getting ready
We can test this kind of authentication in https://httpbin.org.
It has a path, /basic-auth/{user}/{password}, which forces authentication, with the user and password stated. This is very handy for understanding how authentication works.
How to do it...
- Import requests:
>>> import requests...