mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
scrape_text: added tests + hande RequestException
This commit is contained in:
@@ -6,7 +6,10 @@ from llm_utils import create_chat_completion
|
||||
cfg = Config()
|
||||
|
||||
def scrape_text(url):
|
||||
response = requests.get(url, headers=cfg.user_agent_header)
|
||||
try:
|
||||
response = requests.get(url, headers=cfg.user_agent_header)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return "Error: " + str(e)
|
||||
|
||||
# Check if the response contains an HTTP error
|
||||
if response.status_code >= 400:
|
||||
|
||||
Reference in New Issue
Block a user