Skip to content

Commit

Permalink
handler if pin code is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Jul 21, 2024
1 parent 41c0ab9 commit c25035b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 1 addition & 7 deletions example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ def run(y):
return z


client = Quotex(
email="",
password="",
on_pin_code=pin_code_handler,
headless=False,
)

client = Quotex(email="", password="", on_pin_code=pin_code_handler)
client.debug_ws_enable = False


Expand Down
10 changes: 7 additions & 3 deletions quotexpy/http/qxbroker.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os
import re
import json
import pickle
import time
import pickle
import typing
import random
import psutil
import random
import requests
from pathlib import Path
from bs4 import BeautifulSoup
Expand Down Expand Up @@ -46,7 +47,6 @@ def get_cookies_and_ssid(self) -> typing.Tuple[str, str]:

rb = self.browser.execute_script('return document.querySelector(".modal-sign__not-avalible") !== null;')
if rb:
self.close()
raise ConnectionError("quotex is currently not available in your region")

if "trade" not in self.browser.current_url:
Expand All @@ -71,7 +71,11 @@ def get_cookies_and_ssid(self) -> typing.Tuple[str, str]:
self.browser.execute_script('document.querySelector("[name=code]").value = arguments[0];', code)
btn = self.browser.find_element(uc.By.XPATH, "//button[@type='submit']")
btn.click()
time.sleep(10)

time.sleep(random.randint(2, 4))
bc = self.browser.execute_script('return document.querySelector(".hint.hint--danger") !== null;')
if bc:
raise QuotexAuthError("the pin code is incorrect")

cookies = self.browser.get_cookies()
self.api.cookies = cookies
Expand Down

0 comments on commit c25035b

Please sign in to comment.