refactored log_points
This commit is contained in:
parent
5fe05712bd
commit
ced633dd68
14
V6.py
14
V6.py
@ -457,26 +457,22 @@ def bing_pc_search(override=randint(35, 40)):
|
||||
log_error(f"clear la barre de recherche - {format_error(e)}") # what is this message ??? todo
|
||||
|
||||
|
||||
# Sends points to database, discord and whatever service you want
|
||||
# todo: refactor
|
||||
# Sends current account's points to database
|
||||
def log_points():
|
||||
driver = config.WebDriver.driver
|
||||
account = config.UserCredentials.get_mail()
|
||||
|
||||
def get_points():
|
||||
driver.get("https://rewards.bing.com")
|
||||
custom_sleep(1)
|
||||
wait_until_visible(By.CSS_SELECTOR, 'span[mee-element-ready="$ctrl.loadCounterAnimation()"]', browser=driver)
|
||||
try:
|
||||
point = search('availablePoints\":([\d]+)', driver.page_source)[1]
|
||||
except Exception as e:
|
||||
points = search('availablePoints\":([\d]+)', driver.page_source)[1]
|
||||
except Exception as err:
|
||||
log_error(
|
||||
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(e)}")
|
||||
error("Can't get points.")
|
||||
f"Dev error, checking why it doesn't work (waited a bit, is this still white ?) {format_error(err)}")
|
||||
error(f"Can't get points. {format_error(err)}")
|
||||
return -1
|
||||
return point
|
||||
|
||||
points = get_points()
|
||||
custom_sleep(uniform(3, 20))
|
||||
account_name = account.split("@")[0]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user