-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fixes tfa_host incorrectly splitting scheme #127
base: master
Are you sure you want to change the base?
Conversation
c791466
to
9a4637d
Compare
pyaarlo/backend.py
Outdated
@@ -896,7 +896,7 @@ def _login(self): | |||
# If token looks invalid we'll try the whole process. | |||
get_new_session = days_until(self._expires_in) < 2 | |||
if get_new_session: | |||
self._session = cloudscraper.create_scraper() | |||
self._session = cloudscraper.create_scraper(ecdhCurve='secp384r1') |
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.
It's weird. This change is required for me when I run locally on my M1 mac, but it doesn't fix the auth issues when I run inside a docker container.
Can you update and see if this is still needed? Your request made me realise the code was wrong in several places so I fixed them all and added some unit tests to make sure I keep handling this correctly. |
@twrecked Your changes wouldn't fix this issue because the https://github.com/twrecked/pyaarlo/blob/master/pyaarlo/tfa.py#L183C32-L183C40 Having a URL with a scheme is required for requests to work properly. |
@twrecked I just pushed a proposed change to this PR that would fix the issue. Although, I'm not sure implying |
I noticed this the other day as well but have been too busy to fix so thanks for the PR. One comment, in Python the _ at the front is a user/community convention to indicate the function is use internally but this isn't enforced by the interpreter. PyCharm will complain about using it. Maybe a new function? |
Can you try the master again? |
Ah, that would work. I'm not sure if this is an edge-case you want to solve, but this test looks funny. I wouldn't imagine that it prepends def test_host_20(self):
arlo = tests.arlo.PyArlo(tfa_host="imap.gmail.com:998")
self.assertEqual(arlo.cfg.tfa_host, "imap.gmail.com")
self.assertEqual(arlo.cfg.tfa_host_with_scheme, "https://imap.gmail.com")
self.assertEqual(arlo.cfg.tfa_port, 998) |
But since |
What about if I think inferring the scheme from ports could introduce more edge cases since some people might want to use port obfuscation. |
I think converting it to a method and adding the scheme is a good idea. And I'm always using odd ports so trying to pick the right scheme from the port might get complicated. And the tests don't mean much I was just hoping it would do the right thing even if the results aren't meaningful. |
The current implementation returns
https
rather than the scheme + host