33 lines
926 B
Python
33 lines
926 B
Python
|
from time import sleep
|
||
|
|
||
|
|
||
|
# return current page domain
|
||
|
def get_domain(driver):
|
||
|
return driver.current_url.split("/")[2]
|
||
|
|
||
|
|
||
|
def custom_sleep(temps):
|
||
|
try:
|
||
|
if True: # todo: change this awful condition
|
||
|
points = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
|
||
|
passe = 0
|
||
|
for i in range(int(temps)):
|
||
|
for _ in range(8):
|
||
|
sleep(0.125)
|
||
|
passe += 0.125
|
||
|
print(f"{points[i]} - {round(float(temps) - passe, 3)}", end="\r")
|
||
|
print(" ", end="\r")
|
||
|
else:
|
||
|
sleep(temps)
|
||
|
except KeyboardInterrupt:
|
||
|
print("attente annulée")
|
||
|
|
||
|
|
||
|
def format_error(e) -> str:
|
||
|
tb = e.__traceback__
|
||
|
txt = ""
|
||
|
while tb is not None:
|
||
|
txt = txt + f" -> {tb.tb_frame.f_code.co_name} ({tb.tb_lineno}) "
|
||
|
tb = tb.tb_next
|
||
|
return txt + "\n" + str(e)
|