deploy
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "seleniumbase-website-scraper",
|
"name": "seleniumbase-website-scraper",
|
||||||
"description": "SeleniumBase-style browser agent that turns observed website traffic into OpenAPI specs, coverage reports, samples, and a replay client.",
|
"description": "SeleniumBase-style browser agent that turns observed website traffic into OpenAPI specs, coverage reports, samples, and a replay client.",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"entrypoint": {
|
"entrypoint": {
|
||||||
"module": "agent",
|
"module": "agent",
|
||||||
"class_name": "BrowserToApiAgent",
|
"class_name": "BrowserToApiAgent",
|
||||||
@@ -344,7 +344,7 @@
|
|||||||
"source": "python-a2a-pack",
|
"source": "python-a2a-pack",
|
||||||
"project_manifest": {
|
"project_manifest": {
|
||||||
"name": "seleniumbase-website-scraper",
|
"name": "seleniumbase-website-scraper",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"entrypoint": "agent:BrowserToApiAgent"
|
"entrypoint": "agent:BrowserToApiAgent"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
a2a.yaml
5
a2a.yaml
@@ -1,5 +1,5 @@
|
|||||||
name: seleniumbase-website-scraper
|
name: seleniumbase-website-scraper
|
||||||
version: 0.2.0
|
version: 0.2.1
|
||||||
entrypoint: agent:BrowserToApiAgent
|
entrypoint: agent:BrowserToApiAgent
|
||||||
expose:
|
expose:
|
||||||
public: true
|
public: true
|
||||||
@@ -15,6 +15,7 @@ runtime:
|
|||||||
deny_internet_by_default: false
|
deny_internet_by_default: false
|
||||||
apt_packages:
|
apt_packages:
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
|
- chromium
|
||||||
- fonts-liberation
|
- fonts-liberation
|
||||||
- libasound2
|
- libasound2
|
||||||
- libatk-bridge2.0-0
|
- libatk-bridge2.0-0
|
||||||
@@ -38,5 +39,3 @@ runtime:
|
|||||||
- libxkbcommon0
|
- libxkbcommon0
|
||||||
- libxrandr2
|
- libxrandr2
|
||||||
- xdg-utils
|
- xdg-utils
|
||||||
install_commands:
|
|
||||||
- python -m playwright install chromium
|
|
||||||
|
|||||||
21
agent.py
21
agent.py
@@ -13,6 +13,7 @@ import html
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -118,7 +119,7 @@ class BrowserToApiAgent(A2AAgent[BrowserToApiConfig, NoAuth]):
|
|||||||
"SeleniumBase-style browser agent that turns observed website traffic "
|
"SeleniumBase-style browser agent that turns observed website traffic "
|
||||||
"into OpenAPI specs, coverage reports, samples, and a replay client."
|
"into OpenAPI specs, coverage reports, samples, and a replay client."
|
||||||
)
|
)
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
|
|
||||||
config_model = BrowserToApiConfig
|
config_model = BrowserToApiConfig
|
||||||
auth_model = NoAuth
|
auth_model = NoAuth
|
||||||
@@ -338,6 +339,13 @@ def _launch_chromium(p: Any, log: list[str]) -> Any:
|
|||||||
"--no-sandbox",
|
"--no-sandbox",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
system_chromium = _system_chromium_path()
|
||||||
|
if system_chromium:
|
||||||
|
try:
|
||||||
|
log.append(f"browser: using system chromium at {system_chromium}")
|
||||||
|
return p.chromium.launch(executable_path=system_chromium, **launch_kwargs)
|
||||||
|
except Exception as exc: # noqa: BLE001
|
||||||
|
log.append(f"browser warning: system chromium failed: {type(exc).__name__}: {exc}")
|
||||||
try:
|
try:
|
||||||
return p.chromium.launch(**launch_kwargs)
|
return p.chromium.launch(**launch_kwargs)
|
||||||
except Exception as exc: # noqa: BLE001
|
except Exception as exc: # noqa: BLE001
|
||||||
@@ -359,6 +367,17 @@ def _launch_chromium(p: Any, log: list[str]) -> Any:
|
|||||||
return p.chromium.launch(**launch_kwargs)
|
return p.chromium.launch(**launch_kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def _system_chromium_path() -> str | None:
|
||||||
|
for candidate in ("chromium", "chromium-browser", "google-chrome", "google-chrome-stable"):
|
||||||
|
path = shutil.which(candidate)
|
||||||
|
if path:
|
||||||
|
return path
|
||||||
|
for path in ("/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome"):
|
||||||
|
if Path(path).exists():
|
||||||
|
return path
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _fill_search_inputs(page: Any, search_term: str | None, log: list[str]) -> None:
|
def _fill_search_inputs(page: Any, search_term: str | None, log: list[str]) -> None:
|
||||||
if not search_term:
|
if not search_term:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user