Fixes tfa_host incorrectly splitting scheme#127
Fixes tfa_host incorrectly splitting scheme#127katzenbaer wants to merge 1 commit intotwrecked:masterfrom
Conversation
c791466 to
9a4637d
Compare
| 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.
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
httpsrather than the scheme + host