diff --git a/.gitignore b/.gitignore index e58b6e1..067d945 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ __pycache__/ .env -.venv/ \ No newline at end of file +.venv/ +.env.local \ No newline at end of file diff --git a/computers/base_playwright.py b/computers/base_playwright.py index 2c5911e..28515b2 100644 --- a/computers/base_playwright.py +++ b/computers/base_playwright.py @@ -79,6 +79,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): self._playwright.stop() def get_current_url(self) -> str: + """Return the current URL of the page.""" return self._page.url # --- Common "Computer" actions --- @@ -130,9 +131,6 @@ def drag(self, path: List[Dict[str, int]]) -> None: self._page.mouse.move(point["x"], point["y"]) self._page.mouse.up() - def get_current_url(self) -> str: - return self._page.url - # --- Extra browser-oriented actions --- def goto(self, url: str) -> None: try: diff --git a/computers/computer.py b/computers/computer.py index a6b1de5..f124dc5 100644 --- a/computers/computer.py +++ b/computers/computer.py @@ -27,4 +27,6 @@ def keypress(self, keys: List[str]) -> None: ... def drag(self, path: List[Dict[str, int]]) -> None: ... - def get_current_url() -> str: ... + def get_current_url(self) -> str: + """Return the current URL of the computer.""" + ... diff --git a/computers/scrapybara.py b/computers/scrapybara.py index 497c6f6..07aae8e 100644 --- a/computers/scrapybara.py +++ b/computers/scrapybara.py @@ -5,7 +5,7 @@ from playwright.sync_api import sync_playwright, Browser, Page from utils import BLOCKED_DOMAINS -load_dotenv() +load_dotenv(dotenv_path=".env.local") CUA_KEY_TO_SCRAPYBARA_KEY = { "/": "slash",