once again, should be fairly stable

This commit is contained in:
piair 2023-04-02 12:32:21 +02:00
parent ccf284f6e2
commit d579a2c160
2 changed files with 10 additions and 6 deletions

14
V5.py
View File

@ -36,6 +36,7 @@ def firefox_driver(mobile=False, headless=False):
if proxy_enabled : if proxy_enabled :
setup_proxy(proxy_address,proxy_port, options) setup_proxy(proxy_address,proxy_port, options)
options.set_preference("browser.link.open_newwindow", 3) options.set_preference("browser.link.open_newwindow", 3)
options.set_preference("dom.confirm_repost.testing.always_accept", True)
if FAST : if FAST :
options.set_preference("permissions.default.image", 2) #disable image loading. You shouldn't use it except if really nessecary options.set_preference("permissions.default.image", 2) #disable image loading. You shouldn't use it except if really nessecary
if headless: if headless:
@ -228,6 +229,8 @@ def all_cards(): # return to the main page and closes all other tabs
printf(f"fermeture : {driver.current_url}") printf(f"fermeture : {driver.current_url}")
driver.close() driver.close()
driver.switch_to.window(driver.window_handles[0]) driver.switch_to.window(driver.window_handles[0])
if driver.current_url != "https://www.bing.com/rewardsapp/flyout":
driver.get("https://www.bing.com/rewardsapp/flyout")
reset(part2) reset(part2)
def daily_cards(): # cartes de la premiere partie (renouvelées chaque jours). def daily_cards(): # cartes de la premiere partie (renouvelées chaque jours).
@ -296,7 +299,7 @@ def all_cards(): # return to the main page and closes all other tabs
for _ in range(10): for _ in range(10):
try : try :
driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div/div[1]/div[2]").click() driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div/div[1]/div[2]").click()
close_tab(driver.window_handles[1]) reset()
except Exception as e: except Exception as e:
print(format_error(e)) print(format_error(e))
break break
@ -793,6 +796,11 @@ def daily_routine(custom = False):
except Exception as e: except Exception as e:
log_error(e) log_error(e)
try:
fidelity()
except Exception as e:
log_error(e)
try: try:
bing_pc_search() bing_pc_search()
except Exception as e: except Exception as e:
@ -803,10 +811,6 @@ def daily_routine(custom = False):
except Exception as e: except Exception as e:
log_error(e) log_error(e)
try:
fidelity()
except Exception as e:
log_error(e)
try: try:
log_points(_mail) log_points(_mail)

View File

@ -50,7 +50,7 @@ def format_error(e) -> str:
tb = e.__traceback__ tb = e.__traceback__
txt = "" txt = ""
while tb != None : while tb != None :
txt = txt + f" ({tb.tb_lineno}) -> {tb.tb_frame.f_code.co_name}" txt = txt + f" -> {tb.tb_frame.f_code.co_name} ({tb.tb_lineno}) "
tb = tb.tb_next tb = tb.tb_next
return(txt + "\n" + str(e)) return(txt + "\n" + str(e))