File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -120,18 +120,23 @@ async def _introduce(self) -> str:
120
120
async with self ._request .get (url ) as response :
121
121
text = await response .text ()
122
122
self ._expires = datetime .utcnow ()
123
- login_url : List [str ] = re .findall ("url = '(.+?)'" , text )
123
+ login_url : List [str ] = re .findall ("(?: url|href) ?= ? '(.+?)'" , text )
124
124
if not login_url :
125
125
if "oauth/done#access_token=" in text :
126
126
self ._parse_token_data (text )
127
127
raise exceptions .HonNoAuthenticationNeeded ()
128
128
await self ._error_logger (response )
129
+ # As of July 2024 the login page has changed, and we started getting a /NewhOnLogin based relative URL in JS to parse
130
+ if login_url [0 ].startswith ("/NewhOnLogin" ):
131
+ # Force use of the old login page to avoid having to make the new one work..
132
+ login_url [0 ] = f"{ const .AUTH_API } /s/login{ login_url [0 ]} "
129
133
return login_url [0 ]
130
134
131
135
async def _manual_redirect (self , url : str ) -> str :
132
136
async with self ._request .get (url , allow_redirects = False ) as response :
133
- if not (new_location := response .headers .get ("Location" , "" )):
134
- await self ._error_logger (response )
137
+ new_location = response .headers .get ("Location" , "" )
138
+ if not new_location :
139
+ return url
135
140
return new_location
136
141
137
142
async def _handle_redirects (self , login_url : str ) -> str :
Original file line number Diff line number Diff line change 7
7
8
8
setup (
9
9
name = "pyhOn" ,
10
- version = "0.17.4 " ,
10
+ version = "0.17.5 " ,
11
11
author = "Andre Basche" ,
12
12
description = "Control hOn devices with python" ,
13
13
long_description = long_description ,
You can’t perform that action at this time.
0 commit comments