AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
browse: make scrape_links() & scrape_text() "status_code >= 400" error message the same
Itamar Friedman64c21ee8f7ad
diff --git a/scripts/browse.py b/scripts/browse.pyindex 810606a33c..2edc156b24 100644--- a/scripts/browse.py+++ b/scripts/browse.py@@ -79,7 +79,7 @@ def scrape_links(url):# Check if the response contains an HTTP errorif response.status_code >= 400:- return "error"+ return "Error: HTTP " + str(response.status_code) + " error"soup = BeautifulSoup(response.text, "html.parser")diff --git a/tests/test_browse_scrape_links.py b/tests/test_browse_scrape_links.pyindex 908e43b9f1..48d74167f6 100644--- a/tests/test_browse_scrape_links.py+++ b/tests/test_browse_scrape_links.py@@ -72,7 +72,7 @@ class TestScrapeLinks:result = scrape_links("https://www.invalidurl.com")# Assert that the function returns "error"- assert result == "error"+ assert "Error:" in result# Tests that the function returns an empty list when the html contains no hyperlinks.def test_no_hyperlinks(self, mocker):