mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 22:44:21 +01:00
Adding most basic URL validation in scrape_text
This commit is contained in:
@@ -6,6 +6,10 @@ from llm_utils import create_chat_completion
|
|||||||
cfg = Config()
|
cfg = Config()
|
||||||
|
|
||||||
def scrape_text(url):
|
def scrape_text(url):
|
||||||
|
# Most basic check if the URL is valid:
|
||||||
|
if not url.startswith('http'):
|
||||||
|
return "Error: Invalid URL"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=cfg.user_agent_header)
|
response = requests.get(url, headers=cfg.user_agent_header)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user