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


Groups > comp.lang.python > #7626

Question regarding DNS resolution in urllib2

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin1!goblin.stu.neva.ru!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nitw.saurabh@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'https': 0.07; 'override': 0.07; 'urllib2': 0.07; 'advance.': 0.09; 'subject:DNS': 0.09; '>>>': 0.12; 'f.read()': 0.16; 'trying': 0.23; 'subject:Question': 0.25; 'script': 0.27; 'thanks': 0.28; 'problem': 0.28; 'host': 0.29; 'received:209.85.160': 0.29; 'print': 0.31; 'apply': 0.32; 'received:209.85.160.46': 0.32; 'received:mail- pw0-f46.google.com': 0.32; 'to:addr:python-list': 0.33; 'question': 0.34; 'dns': 0.35; 'else': 0.35; 'message- id:@gmail.com': 0.36; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'http': 0.37; 'case': 0.37; 'but': 0.38; 'returning': 0.38; 'some': 0.38; 'url:google': 0.38; 'received:209': 0.39; 'header:Mime-Version:1': 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'header': 0.40; 'plain': 0.40; 'hope': 0.60; 'header:Message-Id:1': 0.62; 'domains': 0.67; 'can\x92t': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:content-type:content-transfer-encoding :date:subject:to:message-id:mime-version:x-mailer; bh=Rm2ZaZ5Wpoe2KAnKS1FBxJWuiwL8BxJ3er6IsgdN0RM=; b=fqOx/8NoDCjNdRfPlaekaMnUJtKx399unJhajEusHZeL9VApvZQIMHKVwixdXzPXW6 KpMXMdiJLBh4MGdHNolbaUoghZq6AopsgqkncGRwyKvfLiwfAWccFwazcU3GMxn0Dw3Q zw+zBe8rgzTTnP5N3ogUjo8TVQmukhhlluEzs=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:date:subject:to :message-id:mime-version:x-mailer; b=Y7qCSugIUeAWG+GYytQCEwyvfb+XMNgvx4V9tBiywmSfm9qagRXMB3NzXsD0H6AFqu MAAQ4JOvQyFW7Yh5v96QF2cUxUQku1hDcVNka5IYSh6gQUugzjCfEJ3UMnL9xV977m3O jUjmS+8uYSf/8kp2NMKNtsVLwkvP6rsJvE1PQ=
From saurabh verma <nitw.saurabh@gmail.com>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Date Wed, 15 Jun 2011 00:04:33 +0530
Subject Question regarding DNS resolution in urllib2
To python-list@python.org
Mime-Version 1.0 (Apple Message framework v1084)
X-Mailer Apple Mail (2.1084)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.229.1308076170.11593.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 82.94.164.166
X-Trace 1308076171 news.xs4all.nl 49045 [::ffff:82.94.164.166]:57922
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7626

Show key headers only | View raw


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 

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web