Skip to content

Commit

Permalink
fix: double login required (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
0verEngineer authored Nov 15, 2024
1 parent dc951d5 commit 4a3fb23
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/kleinanzeigen_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,21 @@ async def login(self) -> None:
except TimeoutError:
pass

await self.fill_login_data_and_send()
await self.handle_after_login_logic()

# Sometimes a second login is required
if not self.is_logged_in():
await self.fill_login_data_and_send()
await self.handle_after_login_logic()

async def fill_login_data_and_send(self) -> None:
LOG.info("Logging in as [%s]...", self.config["login"]["username"])
await self.web_input(By.ID, "email", self.config["login"]["username"])
await self.web_input(By.ID, "password", self.config["login"]["password"])
await self.web_click(By.CSS_SELECTOR, "form#login-form button[type='submit']")

async def handle_after_login_logic(self) -> None:
try:
await self.web_find(By.TEXT, "Wir haben dir gerade einen 6-stelligen Code für die Telefonnummer", timeout = 4)
LOG.warning("############################################")
Expand Down

0 comments on commit 4a3fb23

Please sign in to comment.