-
Notifications
You must be signed in to change notification settings - Fork 38
Allow user defined port #126
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
base: master
Are you sure you want to change the base?
Allow user defined port #126
Conversation
|
What's the use case? Can you change the port the fritzbox is using? 🤔 |
|
You can change the port when using the remote acces via myfritz (see this feature request) |
| if host.startswith("https://") or host.startswith("http://"): | ||
| self.base_url = f"{host}:{port}" if port else host | ||
| else: | ||
| self.base_url = f"http://{host}:{port}" if port else f"http://{host}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should not assume http but https if the port ist 443 here, so we don't get errors if someone enters the port but not the url scheme. I'm unsure how realistic this is 😉.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this logic is just adopted from the get_prefixed_host(), so I didn't want to change the behaviour of the host field now 😬
Interesting. I don't use myfritz, so I didn't know that. Just a small note. Code looks good apart from that. Thank you 👍 . |
This replaces the method get_prefixed_host() by base_url property to allow user defined port