37 lines
1017 B
Python
37 lines
1017 B
Python
from time import sleep
|
|
|
|
from modules.Tools.logger import info, error
|
|
|
|
|
|
# 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 _ in range(int(temps)):
|
|
for i 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:
|
|
info("Wait canceled.")
|
|
except Exception as err:
|
|
error(err)
|
|
|
|
|
|
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)
|