File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1111
1212def handleRequests (query ):
1313 '''Returns HTML document'''
14+ URL = 'https://www.dictionary.com/browse/{0}' .format (query )
1415 try :
15- response = requests .get (f'https://www.dictionary.com/browse/{ query } ' ).text
16- return response
16+ return requests .get (URL , allow_redirects = False ).text
1717 except Exception :
1818 raise ConnectionError ("Error occured while fetching data from the web, please try checking the internet connection." )
1919
2020def ParseUsage (query ):
2121 '''Returns HTML document'''
22+ URL = 'https://www.lexico.com/en/definition/{0}' .format (query )
2223 try :
23- response = requests .get (f'https://www.lexico.com/en/definition/ { query } ' ).text
24+ response = requests .get (URL , allow_redirects = False ).text
2425 return response
2526 except Exception :
2627 raise ConnectionError ("Error occured while fetching data from the web, please try checking the internet connection." )
2728
2829def ParseSynonymsAndAntonyms (query ):
2930 '''Returns HTML document'''
31+ URL = 'https://www.thesaurus.com/browse/{0}' .format (query )
3032 try :
31- response = requests .get (f'https://www.thesaurus.com/browse/ { query } ' ).text
33+ response = requests .get (URL , allow_redirects = False ).text
3234 return response
3335 except Exception :
3436 raise ConnectionError ("Error occured while fetching data from the web, please try checking the internet connection." )
You can’t perform that action at this time.
0 commit comments