diff --git a/V7/actions/websearch.py b/V7/actions/websearch.py deleted file mode 100644 index 3bf0b03..0000000 --- a/V7/actions/websearch.py +++ /dev/null @@ -1,25 +0,0 @@ -from random import choice - -from playwright.sync_api import sync_playwright, expect, Page -from playwright_stealth import stealth_sync - -h = open("../user_data/french", "r", encoding="utf-8") -lines = h.readlines() -if len(lines) < 3: - Liste_de_mot = list(lines[0].split(",")) -else: - Liste_de_mot = [x.replace('\n', "") for x in lines] -h.close() - - -def pc_search(page: Page) -> None: - mot = choice(Liste_de_mot).replace(" ", "+") - page.goto(f"https://www.bing.com/search?q={mot}") - - for _ in range(35): # todo de-hardcode this variable - word = choice(Liste_de_mot) - page.get_by_label("Enter your search here -").click() - page.get_by_label("Enter your search here -").fill(word) - page.get_by_label("Enter your search here -").press("Enter") - page.wait_for_load_state("load") - page.wait_for_timeout(3000) # todo check if there is a better method than hardcoded timout diff --git a/V7/tools/config.py b/V7/tools/config.py deleted file mode 100644 index ad9908f..0000000 --- a/V7/tools/config.py +++ /dev/null @@ -1,47 +0,0 @@ -from playwright.sync_api import sync_playwright, expect, Page, BrowserContext -from playwright_stealth import stealth_sync -from pyvirtualdisplay.smartdisplay import SmartDisplay - -from actions.cards import daily_cards, more_cards, all_cards -from actions.login import login -from actions.websearch import pc_search -from tools.browser_setup import create_display, start_browser -from tools.logger import * -import sys -import json - - -def check_config(data: dict) -> None: - info("Checking config file.") - try: - assert data["accounts"]["nb"] != 0, "No accounts found in the file" - for i in range(data["accounts"]["nb"]): - assert data["accounts"][str(i)]["mail"] != "", f"Account {i} has no mail." - assert data["accounts"][str(i)]["pwd"] != "", f"Account {i} has no password." - assert data["config"]["vnc_enabled"] in ["True", "False"], f"vnc_enable should be either True or False." - assert data["config"]["claim"] in ["True", "False"], f"claim should be either True or False." - assert 1024 < data["config"]["vnc_port"] < 65535, f"vnc_port should be a valid port." - assert data["config"]["vnc_port"] not in [1234], f"vnc_port should be different than the webserver's ports." - except AssertionError as e: - critical(e) - exit(1) - except KeyError as e: - critical(f"Malformed config file. Missing {e}. Refer to the example config file.") - exit(1) - info("Successfully Checked config.") - - -def load_parameters() -> dict: - parameters = sys.argv - if len(parameters) == 1: - critical("Started with no parameters. Please provide at least a config file.") - exit(1) - if len(parameters) > 2: - warning("Started with multiple parameters. Some will be ignored") - try: - with open(parameters[1], "r") as f: - data = json.load(f) - return data - except FileNotFoundError: - critical("Could not open the config file.") - exit(1)