prince1604 commited on
Commit ·
966b662
1
Parent(s): c50a4e1
Fix Import Error: Explicitly install playwright-stealth in Dockerfile and log actual import errors
Browse files- Dockerfile +1 -0
- src/crawler.py +2 -2
Dockerfile
CHANGED
|
@@ -11,6 +11,7 @@ COPY requirements.txt /code/requirements.txt
|
|
| 11 |
# Install Python dependencies
|
| 12 |
# We assume requirements.txt includes flask, gunicorn, playwright, etc.
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
|
| 14 |
|
| 15 |
# Copy the rest of the application code
|
| 16 |
COPY . /code
|
|
|
|
| 11 |
# Install Python dependencies
|
| 12 |
# We assume requirements.txt includes flask, gunicorn, playwright, etc.
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 14 |
+
RUN pip install playwright-stealth
|
| 15 |
|
| 16 |
# Copy the rest of the application code
|
| 17 |
COPY . /code
|
src/crawler.py
CHANGED
|
@@ -157,8 +157,8 @@ class Crawler:
|
|
| 157 |
from playwright.sync_api import sync_playwright
|
| 158 |
from playwright_stealth import stealth_sync
|
| 159 |
logger.info("[-] playwright_libraries_imported_successfully")
|
| 160 |
-
except ImportError:
|
| 161 |
-
logger.error("[!] playwright_import_failed:
|
| 162 |
return None
|
| 163 |
|
| 164 |
try:
|
|
|
|
| 157 |
from playwright.sync_api import sync_playwright
|
| 158 |
from playwright_stealth import stealth_sync
|
| 159 |
logger.info("[-] playwright_libraries_imported_successfully")
|
| 160 |
+
except ImportError as e:
|
| 161 |
+
logger.error(f"[!] playwright_import_failed: {e}")
|
| 162 |
return None
|
| 163 |
|
| 164 |
try:
|