feat: include sleep to wait for driver setup logic and remove yaspin
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
This commit is contained in:
6
main.py
6
main.py
@@ -5,7 +5,7 @@ import socket
|
||||
import logging
|
||||
import os
|
||||
import argparse
|
||||
from yaspin import yaspin
|
||||
from time import sleep
|
||||
from functools import partial
|
||||
from http.server import HTTPServer
|
||||
from utils.PostHandler import Handler
|
||||
@@ -50,7 +50,6 @@ def interrupt_handler(signum, driver: webdriver.Remote):
|
||||
driver.quit()
|
||||
raise SystemExit
|
||||
|
||||
@yaspin()
|
||||
def setupChromeDriver(command_executor: str | None, webrtc_internals_path: str) -> webdriver.Remote | webdriver.Chrome:
|
||||
logger.log(logging.INFO, 'Setting up Chrome driver.')
|
||||
chrome_options = Options()
|
||||
@@ -180,11 +179,12 @@ def downloadStats(driver: webdriver.Remote | webdriver.Chrome, peersDict: dict,
|
||||
def convert_to_bytes(down, downUnit):
|
||||
return float(down) * (1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[downUnit])
|
||||
|
||||
@yaspin()
|
||||
def setupStats(driver: webdriver.Remote, url: str, retries: int = 5) -> webdriver.Remote:
|
||||
logger.log(logging.INFO, 'Setting up stats.')
|
||||
actions = ActionChains(driver)
|
||||
wait = WebDriverWait(driver, 30, poll_frequency=0.2)
|
||||
|
||||
sleep(2)
|
||||
|
||||
for attempt in range(retries):
|
||||
driver.get(url)
|
||||
|
Reference in New Issue
Block a user