Path: csiph.com!usenet.pasdenom.info!goblin2!goblin3!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'configure': 0.04; 'python': 0.09; 'blocking': 0.09; 'closed,': 0.09; 'runs,': 0.09; 'cc:addr:python-list': 0.10; 'skip:p 40': 0.15; '407': 0.16; 'subject:URL': 0.16; 'subject:internet': 0.16; 'url.': 0.16; 'url:example': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'pfxlen:0': 0.17; 'skip:u 30': 0.17; 'variables': 0.17; 'email addr:gmail.com>': 0.20; 'import': 0.21; 'error.': 0.21; 'disable': 0.22; 'http': 0.22; 'help.': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'guess': 0.27; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'environment': 0.29; 'firewall': 0.29; 'url:mailman': 0.29; 'url :non-standard http port': 0.30; 'window': 0.30; 'code': 0.31; 'url:python': 0.32; "skip:' 20": 0.32; 'info': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'hi,': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'there': 0.35; 'skip:u 20': 0.36; 'url:org': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'gives': 0.39; 'url:mail': 0.40; 'your': 0.60; 'provide': 0.62; 'explorer': 0.65; 'below.': 0.68; 'internet': 0.71; 'url:htm': 0.71; '2013': 0.84; 'opener': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=r6RLwS/ejrOo25P0qB2m0/iNMdabopN+Gu4nAdcX9Jo=; b=SHYc7lokAwpS+wGkQ8FqXmvUJexwOxIVoDeZlx4c2+sN17iY6BzabMmK4Bw8NY4XXF +12jDr0xPa5vdSOsxWpg/vR4QVwa8aIfdano4YuEfhYN4xF7XUMsL7PqAjpMQcJlsfVV 6ODTlee3O5U3PDyx4syPlfltg8UIma9baLcOQ8c5jwBUSgAIfjEpo+u8Ds4Hb2phw2pu HCm60mkOgljwlRoFHil7Bj7do6Umli2Q3Y1kURH8FKNyPSEpYT5VN2mVeAJzbEQw7oWv UIzPiEYxqNZhS+AOEnvMo4Zm6AV8rbsBI3kYRkRUfX+scNg3S23UfeeK3AJVAcM21xjB U39Q== MIME-Version: 1.0 X-Received: by 10.152.134.40 with SMTP id ph8mr27503586lab.39.1362647400938; Thu, 07 Mar 2013 01:10:00 -0800 (PST) In-Reply-To: <17e5f19c-57d1-461b-bf1c-59a525922511@googlegroups.com> References: <17e5f19c-57d1-461b-bf1c-59a525922511@googlegroups.com> Date: Thu, 7 Mar 2013 09:10:00 +0000 Subject: Re: Unable to connect to internet URL behind firewall From: "Vytas D." To: priyanka.khamankar@gmail.com Content-Type: multipart/alternative; boundary=f46d042f964249813604d7521256 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 130 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362647409 news.xs4all.nl 6932 [2001:888:2000:d::a6]:40816 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40724 --f46d042f964249813604d7521256 Content-Type: text/plain; charset=ISO-8859-1 Hi, My guess is that your firewall is blocking the connections. To check this, disable your firewall and run your python program. If it runs, you have to configure your firewall to allow your program to connect to the internet. Vytas On Wed, Mar 6, 2013 at 4:28 PM, wrote: > Hi, > > I am using below two approaches to connect to read the content of internet > url. > These two approaches work for me when the internet explorer session is > open. > > When the internet explorer window is closed, below code gives me 407 error. > I have also set the HTTP_PROXY environment variables as > http://proxy-example.com:3128 > > Is there any way that the Python does not use Internet explorer proxy > settings? > I want my python script to work even when the IE window is closed.Please > help. > > I am using Python version 2.6. Python code I am using is provide below. > > Approach 1: > import urlib2 > > # == HTTP == > # > # HTTP with auth info in ProxyHandler is working > # > proxy_handler = urllib2.ProxyHandler({'http': ' > http://user:pass@proxy-example.com:3128/'}) > opener = urllib2.build_opener(proxy_handler) > response = opener.open('http://example.com/testpage.htm') > print response.read() > > Approach 2: > # HTTP with AuthHandler is working > # > proxy_handler = urllib2.ProxyHandler({'http': ' > http://proxy-example.com:3128/'}) > proxy_auth_handler = urllib2.ProxyBasicAuthHandler() > proxy_auth_handler.add_password('realm', 'proxy-example.com:3128', > 'user', 'pass') > > opener = urllib2.build_opener(proxy_handler, proxy_auth_handler) > response = opener.open('http://example.com/testpage.htm') > print response.read() > -- > http://mail.python.org/mailman/listinfo/python-list > --f46d042f964249813604d7521256 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

My guess is that your firewall = is blocking the connections. To check this, disable your firewall and run y= our python program. If it runs, you have to configure your firewall to allo= w your program to connect to the internet.

Vytas


On Wed, Mar 6, 2013 at 4:28 PM, <priyanka.kha= mankar@gmail.com> wrote:
Hi,

I am using below two approaches to connect to read the content of internet = url.
These two approaches work for me when the internet explorer session is open= .

When the internet explorer window is closed, below code gives me 407 error.=
I have also set the HTTP_PROXY environment variables as http://proxy-example.com:3128<= br>
Is there any way that the Python does not use Internet explorer proxy setti= ngs?
I want my python script to work even when the IE window is closed.Please he= lp.

I am using Python version 2.6. Python code I am using is provide below.

Approach 1:
import urlib2

# =3D=3D HTTP =3D=3D
#
# HTTP with auth info in ProxyHandler is working
#
proxy_handler =3D urllib2.ProxyHandler({'http': 'http://user:p= ass@proxy-example.com:3128/'})
opener =3D urllib2.build_opener(proxy_handler)
response =3D opener.open('http://example.com/testpage.htm')
print response.read()

Approach 2:
# HTTP with AuthHandler is working
#
proxy_handler =3D urllib2.ProxyHandler({'http': 'http://proxy-example.co= m:3128/'})
proxy_auth_handler =3D urllib2.ProxyBasicAuthHandler()
proxy_auth_handler.add_password('realm', 'proxy-example.com:3128', = 9;user', 'pass')

opener =3D urllib2.build_opener(proxy_handler, proxy_auth_handler)
response =3D opener.open('http://example.com/testpage.htm')
print response.read()
--
http://mail.python.org/mailman/listinfo/python-list

--f46d042f964249813604d7521256--