0
我需要使用PyCurl來獲取輸入URL的dns解析結果。以下是代碼:Pycurl中的DNS解析結果
buf = cStringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url)
c.setopt(c.WRITEFUNCTION, buf.write)
c.setopt(c, c.CURL_IPRESOLVE_WHATEVER, host)
c.setopt(c.HTTPHEADER, ["User-Agent: "])
# c.setopt(c.CONNECTTIMEOUT, 20)
c.setopt(c.TIMEOUT, 15)
c.setopt(c.FOLLOWLOCATION, True)
c.perform()
我已經搜索了Pycurl文檔並沒有找到一個好的答案。