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


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

Unable to connect to internet URL behind firewall

Started bypriyanka.khamankar@gmail.com
First post2013-03-06 08:28 -0800
Last post2013-03-07 09:31 +0000
Articles 3 — 3 participants

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


Contents

  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

#40644 — Unable to connect to internet URL behind firewall

Frompriyanka.khamankar@gmail.com
Date2013-03-06 08:28 -0800
SubjectUnable to connect to internet URL behind firewall
Message-ID<17e5f19c-57d1-461b-bf1c-59a525922511@googlegroups.com>
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()

[toc] | [next] | [standalone]


#40724

From"Vytas D." <vytasd2013@gmail.com>
Date2013-03-07 09:10 +0000
Message-ID<mailman.2991.1362647408.2939.python-list@python.org>
In reply to#40644

[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
>

[toc] | [prev] | [next] | [standalone]


#40732

FromSven <svenito@gmail.com>
Date2013-03-07 09:31 +0000
Message-ID<mailman.2997.1362648692.2939.python-list@python.org>
In reply to#40644

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

On 6 March 2013 16:28, <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
>

>From experience the environment variable name is in lowercase. Try
http_proxy instead.

Don't ask me why this environment variable is lowercase when most others
aren't.

-- 
./Sven

[toc] | [prev] | [standalone]


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


csiph-web