Update backend.py

This commit is contained in:
H Lohaus 2025-10-04 19:29:09 +02:00 committed by GitHub
parent 242c8281fd
commit f17056ff71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,12 @@ try:
has_requirements = True
except:
has_requirements = False
try:
from g4f.tools.web_search import
search
has_search = True
except:
has_search = False
try:
from ddgs.exceptions import DDGSException
except ImportError:
@ -39,7 +45,9 @@ class TestBackendApi(unittest.TestCase):
self.assertTrue(len(response) > 0)
def test_search(self):
from g4f.gui.server.internet import search
if not has_search:
self.skipTest("import error")
return
try:
result = asyncio.run(search("Hello"))
except DDGSException as e: