johann22 commited on
Commit
8a32d88
1 Parent(s): c6d4a9e

Update i_search.py

Browse files
Files changed (1) hide show
  1. i_search.py +7 -3
i_search.py CHANGED
@@ -13,9 +13,13 @@ headers_Get = {
13
 
14
  def i_search(url):
15
  response = requests.get(url)
16
- response.raise_for_status()
17
- soup = BeautifulSoup(response.content, 'html.parser')
18
- return ' '.join([p.text for p in soup.find_all('p')])
 
 
 
 
19
 
20
 
21
 
 
13
 
14
  def i_search(url):
15
  response = requests.get(url)
16
+ try:
17
+ response.raise_for_status()
18
+ soup = BeautifulSoup(response.content, 'html.parser')
19
+ return ' '.join([p.text for p in soup.find_all('p')])
20
+ except Exception as e:
21
+ print (e)
22
+ return "An Error occured when fetching this website. Please check the URL and try again, or use a different URL"
23
 
24
 
25