fritzbox_helper: Allow login with username

This commit is contained in:
Andreas Oberritter 2020-07-15 13:30:23 +02:00
parent 77afcdad3a
commit 458c9e123c
1 changed files with 4 additions and 1 deletions

View File

@ -27,7 +27,7 @@ import requests
from lxml import etree
def get_session_id(server, password, port=80):
def get_session_id(server, password, port=80, username=None):
"""Obtains the session id after login into the Fritzbox.
See https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AVM_Technical_Note_-_Session_ID.pdf
for deteils (in German).
@ -62,6 +62,9 @@ def get_session_id(server, password, port=80):
else:
return session_id
if username is not None:
params['username'] = username
headers = {"Accept": "text/html,application/xhtml+xml,application/xml",
"Content-Type": "application/x-www-form-urlencoded"}