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


Groups > comp.lang.python > #40724

Re: Unable to connect to internet URL behind firewall

References <17e5f19c-57d1-461b-bf1c-59a525922511@googlegroups.com>
Date 2013-03-07 09:10 +0000
Subject Re: Unable to connect to internet URL behind firewall
From "Vytas D." <vytasd2013@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2991.1362647408.2939.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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, <priyanka.khamankar@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
>
> 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
>

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


Thread

Unable to connect to internet URL behind firewall priyanka.khamankar@gmail.com - 2013-03-06 08:28 -0800
  Re: Unable to connect to internet URL behind firewall "Vytas D." <vytasd2013@gmail.com> - 2013-03-07 09:10 +0000
  Re: Unable to connect to internet URL behind firewall Sven <svenito@gmail.com> - 2013-03-07 09:31 +0000

csiph-web