1 下载与安装
见其他教程。
2 Requsts简介
Requests is an Apache2 Licensed HTTP library, written inPython, for human beings.
Python’s standard urllib2 module provides most ofthe HTTP capabilities you need, but the API is thoroughlybroken.It was built for a different time — and a different web. It requires anenormous amount of work (even method overrides) to perform the simplest oftasks.
Requests takes all of the work out of Python HTTP/1.1 — making your integrationwith web services seamless. There’s no need to manually add query strings toyour URLs, or to form-encode your POST data. Keep-alive and HTTP connectionpooling are 100% automatic, powered by urllib3,which is embedded within Requests.
------from http://www.python-requests.org/en/latest/
3 获取网页源代码(Get方法)
- 直接获取源