-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
It seems that the server sometimes presents redirects using status code 302, and sometimes using 307. The former is properly handled, the latter is not.
Tested on macOS 14.1.2 and Python 3.11, results in the following (shortened) debug output:
--------
return_url='https://singlekey-id.com/auth/connect/authorize/callback?client_id=[...]', <Response [302]>
return_url='https://singlekey-id.com/auth/login?returnUrl=%2Fauth%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3D[...]', <Response [302]>
return_url='https://singlekey-id.com/auth/en-gb/login?returnUrl=%2Fauth%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3D[...]', <Response [307]>
return_url='https://singlekey-id.com/auth/en-gb/login?returnUrl=%2Fauth%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3D[...]'
--------
Traceback (most recent call last):
File "/Users/jorrit/Documents/Projects/home_control_py/./hc-login", line 188, in <module>
code = query.get("code")[0]
~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable
The 302 redirect is properly handled, but the loop is ended upon a 307. This means the remaining code runs on the wrong URL, and crashes.
Changing line 168 seems to resolve this:
if r.status_code != 302 and r_status_code != 307:
pmagyar
Metadata
Metadata
Assignees
Labels
No labels