Tell urllib2 to use custom DNS

前端 未结 3 625
终归单人心
终归单人心 2020-11-30 01:39

I\'d like to tell urllib2.urlopen (or a custom opener) to use 127.0.0.1 (or ::1) to resolve addresses. I wouldn\'t ch

3条回答
  •  死守一世寂寞
    2020-11-30 02:01

    You will need to implement your own dns lookup client (or using dnspython as you said). The name lookup procedure in glibc is pretty complex to ensure compatibility with other non-dns name systems. There's for example no way to specify a particular DNS server in the glibc library at all.

提交回复
热议问题