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


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

Re: Question regarding DNS resolution in urllib2

Started byMichael Hrivnak <mhrivnak@hrivnak.org>
First post2011-06-18 14:03 -0400
Last post2011-06-18 14:03 -0400
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question regarding DNS resolution in urllib2 Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-06-18 14:03 -0400

#7918 — Re: Question regarding DNS resolution in urllib2

FromMichael Hrivnak <mhrivnak@hrivnak.org>
Date2011-06-18 14:03 -0400
SubjectRe: Question regarding DNS resolution in urllib2
Message-ID<mailman.128.1308420197.1164.python-list@python.org>
The latest libcurl includes the CURLOPTS_RESOLVE option
(http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) that will do
what you want.  It may not have made its way into pycurl yet, but you
could just call the command-line curl binary with the --resolve
option.  This feature was introduced in version 7.21.3.

Michael

On Tue, Jun 14, 2011 at 2:34 PM, saurabh verma <nitw.saurabh@gmail.com> wrote:
> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
>

[toc] | [standalone]


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


csiph-web