php - 有没有等同于php的curl_getinfo的python库?

标签 php python http curl

PHP 的 curl_getinfo 返回有关请求时间的详分割类(有关详细信息,请参阅 docs)。有没有可以做同样事情的 python 库?

最佳答案

(py)curlgetinfo

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)

关于php - 有没有等同于php的curl_getinfo的python库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28138038/

相关文章:

php - moodle:来自 stdclass 对象的 SQL where 子句

python - 如何使用 win32com.client 通过 python 将 XLA 添加到 Excel 中?

python - 在 Python 中查找最接近特定值的列表项

android - 在 php 中检索 json 对象

html - 如何使用 htaccess 强制使用 http- 而不是 https

Python str转文件类型

PHP 教义 : Test if an object is in an ArrayCollection

php - 使用 mysql/php 中的 id/parent_id 模型获取记录的所有父项的最简单方法是什么?

php - 一个类可以实例化另一个类吗? (PHP)

python - 如何使用 Pyinstaller 在 Windows 上制作 Mac 文件?