Connecting to a web server with authentification - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Connecting to a web server with authentification (/thread-32312.html) |
Connecting to a web server with authentification - arbiel - Feb-02-2021 Hi I'm trying to connect to the following page https://www.happyvisio.com This server requires authentification. When I connect from a web browser, the response is a page to enter user and password information. When I connect with requests, the request fails import requests r = requests.get('https://www.happyvisio.com/') r.status_code 403 r.text '<html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n' r.headers {'content-length': '93', 'cache-control': 'no-cache', 'content-type': 'text/html', 'connection': 'close'}I understand that the request send by requests is not the same as the one sent by the browser. How can I have requests send the same request ? I also tried command as requests.get('https://www.happyvisio.com', auth=HTTPBasicAuth(user, mdp)) requests.get('https://www.happyvisio.com', auth=HTTPDigestAuth(user, mdp))with no avail. What else do you advise me to try? Arbiel |