unused import + fallback logpoint

This commit is contained in:
piair 2022-06-09 14:34:02 +02:00
parent 69e8916a05
commit 5614a06f38

46
V4.py
View File

@ -1,7 +1,6 @@
#!/usr/bin/python3.10
import asyncio
import configparser
import os
from csv import reader
from os import sys, system
from random import choice, randint, shuffle, uniform
@ -575,12 +574,10 @@ def login():
return driver.current_window_handle
except Exception as e:
LogError("login - 3 - " + str(e))
driver.quit()
driver.close()
CustomSleep(1200)
driver = FirefoxDriver()
return("STOP")
def BingPcSearch(override=randint(35, 40)):
@ -727,18 +724,9 @@ def BingMobileSearch(override=randint(22, 25)):
CustomSleep(uniform(1, 2))
MRGPD()
CustomSleep(uniform(1, 1.5))
send_keys_wait(
MobileDriver.find_element(By.ID, "sb_form_q"),
Keys.BACKSPACE
+ Keys.BACKSPACE
+ Keys.BACKSPACE
+ Keys.BACKSPACE
+ Keys.BACKSPACE
+ Keys.BACKSPACE,
)
for i in range(override): # 20
try :
mot = choice(Liste_de_mot)
send_keys_wait(MobileDriver.find_element(By.ID, "sb_form_q"), mot)
MobileDriver.find_element(By.ID, "sb_form_q").send_keys(Keys.ENTER)
@ -748,9 +736,11 @@ def BingMobileSearch(override=randint(22, 25)):
Alerte() # verifie si il y a des alertes (demande de positions ....)
for i in range(len(mot)):
MobileDriver.find_element(By.ID, "sb_form_q").clear()
except :
driver.refresh()
CustomSleep(30)
i -= 1
MobileDriver.quit()
except Exception as e:
@ -854,14 +844,18 @@ def LogPoint(account="unknown"): # log des points sur discord
CustomSleep(5)
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
CustomSleep(uniform(10, 20))
try:
point = search('availablePoints":([\d]+)', driver.page_source)[1]
except Exception as e:
LogError(f"LogPoint - 2 - {e}")
point = -1
return(point)
point = search('availablePoints":([\d]+)', driver.page_source)[1]
return(point)
for i in range (3):
try :
points = get_points()
break
except Exception as e:
CustomSleep(300)
if not points :
LogError(f"impossible d'avoir les points : {e}")
CustomSleep(uniform(3, 20))
account = account.split("@")[0]
@ -941,6 +935,7 @@ def Fidelite():
def DailyRoutine():
MainWindows = login()
if MainWindows != "STOP" :
try:
AllCard()
except Exception as e:
@ -971,7 +966,8 @@ def DailyRoutine():
LogPoint(_mail)
except Exception as e:
LogError(f"DalyRoutine - LogPoint - \n{e}")
else :
LogError(f"probleme de login sur e comte {_mail}")
def close():
driver.quit()
@ -1011,7 +1007,7 @@ def CustomStart(Credentials):
driver = FirefoxDriver()
driver.implicitly_wait(10)
login()
if login() != "STOP":
if "tout" in Actions:
DailyRoutine()