Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for multiple boxes and username authentication #10

Open
wants to merge 7 commits into
base: fritzos6.5
Choose a base branch
from

Conversation

CWempe
Copy link

@CWempe CWempe commented Mar 2, 2017

This PR is supposed to fix the following issues:

Tested with FRITZ!OS 6.51 and 6.80

@@ -25,7 +25,7 @@
USER_AGENT = "Mozilla/5.0 (U; Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"


def get_sid(server, password, port=80):
def get_sid(server, username, password, port=80):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set default username to None:
def get_sid(server, username=None, password, port=80):

@@ -58,7 +58,7 @@ def get_sid(server, password, port=80):
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": USER_AGENT}

login_page = "/login_sid.lua?&response=" + response_bf
login_page = "/login_sid.lua?username=" + username + "&response=" + response_bf
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If username is not None, use it here, otherwise use the old url

@Tafkas
Copy link
Owner

Tafkas commented Mar 2, 2017

Hi Christoph,

thank you for your PR. I think it looks good. One minor thing, though. You mentioned the authentication with username/password might break the password-only option. How about this:

check if there is a a username set with os.getenv instead of os.environ. The latter will raise an exception in Python 2.7, while the former will return None.

I added some comments in the code as well.

@CWempe
Copy link
Author

CWempe commented Mar 2, 2017

Thank you for your suggestions.
I think this should handle non-username scenarios now.

btw: The API request worked with the username-URL even when authentication was configured for password-only.

As someone who never used python before, I am pretty proud of myself. 😄

@kripton
Copy link

kripton commented Dec 18, 2020

Any reason that this has not been merged? I'd also like to monitor multiple boxes instead of just one

RenWal pushed a commit to RenWal/fritzbox-munin-fast that referenced this pull request Oct 5, 2021
…ig_in_plugins

Add missing user from configuration for plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants