[Python-Dev] making socket.getaddrinfo use cached dns

Oleg Broytman phd at phdru.name
Thu Jul 7 19:59:01 CEST 2011


Hello.

   We are sorry but we cannot help you. This mailing list is to work on
developing Python (adding new features to Python itself and fixing bugs);
if you're having problems learning, understanding or using Python, please
find another forum. Probably python-list/comp.lang.python mailing list/news
group is the best place; there are Python developers who participate in it;
you may get a faster, and probably more complete, answer there. See
http://www.python.org/community/ for other lists/news groups/fora. Thank
you for understanding.

On Thu, Jul 07, 2011 at 12:57:59PM -0400, high bandwidth wrote:
> I use cached dns lookups with pdnsd on my ubuntu machine to speed up web
> access as regular lookups can take 15-30 seconds. However, python's
> mechanize and urllib etc use socket.getaddrinfo, which seems not to be using
> dns cacheing or taking a long time because of ipv6 lookups. In either case,
> I subsequent access to the same site to be fast and not require lengthy
> calls to getaddrinfo. How can I get python to correctly use cached dns
> lookups and ipv4 only (at least in those cases where it is appropriate).
> 
> As mentioned here:
> http://stackoverflow.com/questions/2014534/force-python-mechanize-urllib2-to-only-use-a-requests/2035686#2035686
> It seems that many python libraries are hardcoded to look for both ipv6 and
> ipv4. Since ipv6 lookups are extremely slow at least for some users, perhaps
> the devs should carry over these optional arguments to higher level
> libraries like mechanize, urllib, httplib etc.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list