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.
flake8 style
Itamar Friedman3e53e976a520
diff --git a/scripts/browse.py b/scripts/browse.pyindex c26cde65de..9e93c55a33 100644--- a/scripts/browse.py+++ b/scripts/browse.py@@ -32,7 +32,7 @@ def get_response(url, headers=cfg.user_agent_header, timeout=10):# Restrict access to local filesif check_local_file_access(url):raise ValueError('Access to local files is restricted')-+# Most basic check if the URL is valid:if not url.startswith('http://') and not url.startswith('https://'):raise ValueError('Invalid URL format')@@ -44,7 +44,7 @@ def get_response(url, headers=cfg.user_agent_header, timeout=10):# Check if the response contains an HTTP errorif response.status_code >= 400:return None, "Error: HTTP " + str(response.status_code) + " error"-+return response, Noneexcept ValueError as ve:# Handle invalid URL formatdiff --git a/tests/unit/test_browse_scrape_links.py b/tests/unit/test_browse_scrape_links.pyindex bd57fb84d3..2172d1a2be 100644--- a/tests/unit/test_browse_scrape_links.py+++ b/tests/unit/test_browse_scrape_links.py@@ -48,7 +48,7 @@ class TestScrapeLinks:assert len(result) > 0assert isinstance(result, list)assert isinstance(result[0], str)-+# Tests that the function returns correctly formatted hyperlinks when given a valid url.def test_valid_url(self, mocker):# Mock the requests.get() function to return a response with sample HTML containing hyperlinks@@ -90,7 +90,7 @@ class TestScrapeLinks:# Assert that the function returns an empty listassert result == []- # Tests that scrape_links() correctly extracts and formats hyperlinks from+ # Tests that scrape_links() correctly extracts and formats hyperlinks from# a sample HTML containing a few hyperlinks.def test_scrape_links_with_few_hyperlinks(self, mocker):# Mock the requests.get() function to return a response with a sample HTML containing hyperlinks