fix
This commit is contained in:
parent
bc0c369a92
commit
f761f7b7e8
1 changed files with 6 additions and 3 deletions
|
|
@ -6,8 +6,9 @@ from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from playwright.async_api import async_playwright
|
from playwright.async_api import async_playwright, Browser, BrowserContext, Playwright
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -23,8 +24,9 @@ WGCOMPANY_BEZIRK = os.environ.get("WGCOMPANY_BEZIRK", "0")
|
||||||
|
|
||||||
class WGCompanyNotifier:
|
class WGCompanyNotifier:
|
||||||
def __init__(self, telegram_bot=None, refresh_minutes=10):
|
def __init__(self, telegram_bot=None, refresh_minutes=10):
|
||||||
self.browser = None
|
self.browser: Optional[Browser] = None
|
||||||
self.context = None
|
self.context: Optional[BrowserContext] = None
|
||||||
|
self.playwright: Optional[Playwright] = None
|
||||||
self.telegram_bot = telegram_bot
|
self.telegram_bot = telegram_bot
|
||||||
self.refresh_minutes = refresh_minutes
|
self.refresh_minutes = refresh_minutes
|
||||||
|
|
||||||
|
|
@ -39,6 +41,7 @@ class WGCompanyNotifier:
|
||||||
await self.init_browser()
|
await self.init_browser()
|
||||||
listings = []
|
listings = []
|
||||||
try:
|
try:
|
||||||
|
assert self.context is not None, "Browser context not initialized"
|
||||||
page = await self.context.new_page()
|
page = await self.context.new_page()
|
||||||
search_url = "http://www.wgcompany.de/cgi-bin/seite?st=1&mi=10&li=100"
|
search_url = "http://www.wgcompany.de/cgi-bin/seite?st=1&mi=10&li=100"
|
||||||
logger.info(f"[WGCOMPANY] Loading search page: {search_url}")
|
logger.info(f"[WGCOMPANY] Loading search page: {search_url}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue