擅长:python、mysql、java
<p>本质上,您希望使用<code>urllib2</code>来构建一个特殊的HTTP请求,或者有些人可能会认为第三方<a href="http://docs.python-requests.org/en/latest/" rel="nofollow">requests</a>模块更好。HTTP请求并不是一件太复杂的事情,您首先可能需要阅读关于HTTP请求的一般信息(从<a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" rel="nofollow">Wikipedia</a>开始,或者甚至看看最新发布的<a href="http://tools.ietf.org/html/rfc7230" rel="nofollow">RFC 723*</a>))。在curl调用中,您正在设置某些头参数(使用<code>-H</code>开关)。您可以使用request的<code>custom headers</code>函数轻松地复制这些文件,文档如下:<a href="http://docs.python-requests.org/en/latest/user/quickstart/#custom-headers" rel="nofollow">http://docs.python-requests.org/en/latest/user/quickstart/#custom-headers</a>。在</p>