bots: Correct 'http.bot_handler' to 'http.client' in googlesearch bot.
There is no library as 'http.bot_handler'. 'http.client' is what the author of this bots initially wrote. Searching through the git history shows that someone mistakenly replaced 'client' with 'bot_handler' here.
This commit is contained in:
parent
3234096cea
commit
0625c26c9a
|
@ -1,7 +1,7 @@
|
||||||
# See readme.md for instructions on running this code.
|
# See readme.md for instructions on running this code.
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import logging
|
import logging
|
||||||
import http.bot_handler
|
import http.client
|
||||||
from six.moves.urllib.request import urlopen
|
from six.moves.urllib.request import urlopen
|
||||||
|
|
||||||
# Uses the Google search engine bindings
|
# Uses the Google search engine bindings
|
||||||
|
@ -26,7 +26,7 @@ def get_google_result(search_keywords):
|
||||||
try:
|
try:
|
||||||
urls = search(search_keywords, stop=20)
|
urls = search(search_keywords, stop=20)
|
||||||
urlopen('http://216.58.192.142', timeout=1)
|
urlopen('http://216.58.192.142', timeout=1)
|
||||||
except http.bot_handler.RemoteDisconnected as er:
|
except http.client.RemoteDisconnected as er:
|
||||||
logging.exception(er)
|
logging.exception(er)
|
||||||
return 'Error: No internet connection. {}.'.format(er)
|
return 'Error: No internet connection. {}.'.format(er)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -85,7 +85,7 @@ def test():
|
||||||
urlopen('http://216.58.192.142', timeout=1)
|
urlopen('http://216.58.192.142', timeout=1)
|
||||||
print('Success')
|
print('Success')
|
||||||
return True
|
return True
|
||||||
except http.bot_handler.RemoteDisconnected as e:
|
except http.client.RemoteDisconnected as e:
|
||||||
print('Error: {}'.format(e))
|
print('Error: {}'.format(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue