Skip to content

Commit 59a1c92

Browse files
authored
fix: fix login issues on brazilian marketplace (#204)
1 parent 60a591b commit 59a1c92

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88

99
-
1010

11+
## [0.9.1] - 2023-09-27
12+
13+
## Bugfix
14+
15+
- Fix login issues on brazilian marketplace.
16+
1117
## [0.9.0] - 2023-09-27
1218

1319
## Bugfix

src/audible/login.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,21 @@ def login(
487487

488488
session.close()
489489

490-
if b"openid.oa2.authorization_code" not in login_resp.url.query:
490+
url = None
491+
if b"openid.oa2.authorization_code" in login_resp.url.query:
492+
url = login_resp.url
493+
elif len(login_resp.history) > 0:
494+
for history in login_resp.history:
495+
if b"openid.oa2.authorization_code" in history.url.query:
496+
url = history.url
497+
break
498+
499+
if url is None:
491500
raise Exception("Login failed. Please check the log.")
492501

493502
logger.debug("Login confirmed for %s", username)
494503

495-
authorization_code = extract_code_from_url(login_resp.url)
504+
authorization_code = extract_code_from_url(url)
496505

497506
return {
498507
"authorization_code": authorization_code,

0 commit comments

Comments
 (0)