What is the proper way to Google something in Python 3? I have tried requests
and urllib
for a Google page. When I simply res = requests.get("https://www.google.com/#q=" + query)
that doesn't come back with the same HTML as when I inspect the Google page in Safari. The same happens with urllib
. A similar thing happens when I use Bing. I am familiar with AJAX
. However, it seems that that is now depreciated.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
In python, if you do not specify the user agent header in http requests manually, python will add for you by default which can be detected by Google and may be forbidden by it.
Try the following if it can help.