python爬虫


1135 浏览 6 years, 2 months

3.1 httplib

版权声明: 转载请注明出处 http://www.codingsoho.com/

httplib

https://docs.python.org/2.7/library/httplib.html

:在Python3中,httplib重新命名为http.client

该模块提供下列类

class httplib.HTTPConnection(host[, port[, strict[, timeout[, source_address]]]])
class httplib.HTTPSConnection(host[, port[, key_file[, cert_file[, strict[, timeout[, source_address[, context]]]]]]])
class httplib.HTTPResponse(sock, debuglevel=0, strict=0)
class httplib.HTTPMessage

HTTPConnection的方法和属性

HTTPConnection.request(method, url[, body[, headers]])
HTTPConnection.getresponse()
HTTPConnection.set_debuglevel(level)
HTTPConnection.set_tunnel(host, port=None, headers=None)
HTTPConnection.connect()
HTTPConnection.close()

HTTPResponse的方法和属性

HTTPResponse.read([amt])
HTTPResponse.getheader(name[, default])
HTTPResponse.getheaders()
HTTPResponse.fileno()
HTTPResponse.msg
HTTPResponse.version
HTTPResponse.status
HTTPResponse.reason

httplib2

https://pypi.python.org/pypi/httplib2/