问题
PHP's curl_getinfo
returns detailed breakdown about request time (see the docs for more details). Is there a python library that can do the same thing?
回答1:
(py)curl has getinfo
import pycurl
import cStringIO
curl = pycurl.Curl()
buff = cStringIO.StringIO()
curl.setopt(pycurl.URL, 'http://example.org')
curl.setopt(pycurl.WRITEFUNCTION, buff.write)
curl.perform()
print "status code: %s" % curl.getinfo(pycurl.HTTP_CODE)
来源:https://stackoverflow.com/questions/28138038/is-there-a-python-library-equivalent-to-phps-curl-getinfo