fix: use BACKEND_PORT env var in uvicorn and honor base_url arg in searxSearch

- api.py: uvicorn.run was hardcoding port=7777 instead of using the
  port variable populated from BACKEND_PORT env var, making BACKEND_PORT
  ineffective when running python api.py directly
- searxSearch: add missing 'import sys' (caused NameError when run as
  standalone script) and use constructor base_url arg with env var
  fallback so searxSearch(base_url=...) actually takes effect
This commit is contained in:
Octopus
2026-04-06 10:43:16 +08:00
parent 31205febfe
commit 3fc2ac5235
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import requests
from bs4 import BeautifulSoup
import sys
import os
if __name__ == "__main__": # if running as a script for individual testing
@@ -16,7 +17,7 @@ class searxSearch(Tools):
self.tag = "web_search"
self.name = "searxSearch"
self.description = "A tool for searching a SearxNG for web search"
self.base_url = os.getenv("SEARXNG_BASE_URL") # Requires a SearxNG base URL
self.base_url = base_url or os.getenv("SEARXNG_BASE_URL") # Requires a SearxNG base URL
self.user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
self.paywall_keywords = [
"Member-only", "access denied", "restricted content", "404", "this page is not working"