Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7626 > unrolled thread

Question regarding DNS resolution in urllib2

Started bysaurabh verma <nitw.saurabh@gmail.com>
First post2011-06-15 00:04 +0530
Last post2011-06-15 00:04 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Question regarding DNS resolution in urllib2 saurabh verma <nitw.saurabh@gmail.com> - 2011-06-15 00:04 +0530

#7626 — Question regarding DNS resolution in urllib2

Fromsaurabh verma <nitw.saurabh@gmail.com>
Date2011-06-15 00:04 +0530
SubjectQuestion regarding DNS resolution in urllib2
Message-ID<mailman.229.1308076170.11593.python-list@python.org>
hi ,

I trying to use urllib2 in my script , but the problem is lets say a domains resolves to multiple IPs , If the URL is served by plain http , I can add “Host: domain” header and check whether all IPs are returning proper responses or not , but in case of https , I have to trust on my local machines dns resolver and I can’t apply host header in the request . 

Is it possible to override dns resolver in urllib2 or something else ? 

>>> req = urllib2.Request(url='https://google.com/')
>>> f = urllib2.urlopen(req)
>>> print f.read()

I wanted to control the IPs which urllib2 is trying to connect . 


I Hope I am some sense out of my question , 

Thanks in advance. 

~saurabh 

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web