Python Forum
Connecting to a web server with authentification
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connecting to a web server with authentification
#1
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
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020