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 11
11
12
12
def handleRequests (query ):
13
13
'''Returns HTML document'''
14
+ URL = 'https://www.dictionary.com/browse/{0}' .format (query )
14
15
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
17
17
except Exception :
18
18
raise ConnectionError ("Error occured while fetching data from the web, please try checking the internet connection." )
19
19
20
20
def ParseUsage (query ):
21
21
'''Returns HTML document'''
22
+ URL = 'https://www.lexico.com/en/definition/{0}' .format (query )
22
23
try :
23
- response = requests .get (f'https://www.lexico.com/en/definition/ { query } ' ).text
24
+ response = requests .get (URL , allow_redirects = False ).text
24
25
return response
25
26
except Exception :
26
27
raise ConnectionError ("Error occured while fetching data from the web, please try checking the internet connection." )
27
28
28
29
def ParseSynonymsAndAntonyms (query ):
29
30
'''Returns HTML document'''
31
+ URL = 'https://www.thesaurus.com/browse/{0}' .format (query )
30
32
try :
31
- response = requests .get (f'https://www.thesaurus.com/browse/ { query } ' ).text
33
+ response = requests .get (URL , allow_redirects = False ).text
32
34
return response
33
35
except Exception :
34
36
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