Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
BoPeng committed Jan 29, 2025
1 parent 27ade0f commit 0150495
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ai_marketplace_monitor/ai.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from logging import Logger
from typing import Any, ClassVar, Dict, Type

from openai import OpenAI
from openai import OpenAI # type: ignore
from rich.pretty import pretty_repr

from .items import SearchedItem
Expand Down
4 changes: 3 additions & 1 deletion src/ai_marketplace_monitor/facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from urllib.parse import quote

from bs4 import BeautifulSoup, element # type: ignore
from playwright.sync_api import Browser, Page
from playwright.sync_api import Browser, Page # type: ignore
from rich.pretty import pretty_repr

from .items import SearchedItem
Expand Down Expand Up @@ -233,6 +233,7 @@ def filter_item(


class WebPage:

def __init__(self: "WebPage", html: str, logger: Logger) -> None:
self.html = html
self.soup = BeautifulSoup(self.html, "html.parser")
Expand Down Expand Up @@ -326,6 +327,7 @@ def get_listings(self: "FacebookSearchResultPage") -> List[SearchedItem]:


class FacebookItemPage(WebPage):

def get_image_url(self: "FacebookItemPage") -> str:
try:
return self.soup.find("img")["src"]
Expand Down
1 change: 1 addition & 0 deletions src/ai_marketplace_monitor/marketplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def stop(self: "Marketplace") -> None:

def goto_url(self: "Marketplace", url: str, attempt: int = 0) -> None:
try:
assert self.page is not None
self.page.goto(url, timeout=0)
self.page.wait_for_load_state("domcontentloaded")
except Exception as e:
Expand Down

0 comments on commit 0150495

Please sign in to comment.