python - DNS resolve result in Pycurl -


i need result of dns resolution of input url using pycurl. following code:

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() 

i have searched pycurl documentation , didn't find answer.

i have searched in documentation of libcurl , found getinfo() function described in link : https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html careful c , when using in pycurl have convert constants using link : https://github.com/pycurl/pycurl/blob/master/src/module.c#l1134

as answer retrieve ip address of url following line should added:

print(c.getinfo(c.primary_ip)) 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -