I have an URL, I call it https://testsite.test.de/Interfaces
, looks like the real one.
When I enter the URL into the Browser it immediately opens a Benutzername and Passwort window, it is in German, the former is username. When I click Inspect in Firefox the inspector is empty, only under network there is one line with GET and the URL. After logging in, there should appear “Connected to websocket” and there is a real time data stream shown which I want to scrape into to further analyze.
What I did:
import requests
username = 'myname'
password = 'mypassword'
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0'}
login_data = {
'Benutzername': username,
'Passwort': password
}
r = requests.get('https://testsite.test.de/Interfaces',
headers=headers,
data=login_data)
print(r.status_code)
The output is status code: 401
What did I wrong? Help appreciated.