我希望能够在不使用网站API的情况下访问网站。我是否可以使用Mechanize之类的工具来实现这一点?
以下是两个建议的答案:
http://docs.python.org/library/httplib.html
http://docs.python.org/library/urllib.html
另外,Dive into Python3 的第13章“HTTP Web Services”也是一个很好的介绍:https://diveintopython3.net/http-web-services.html
#for Python 3.2
import urllib.request
page = urllib.request.urlopen("http://www.google.com")
print (page.read())