473,503 Members | 12,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urllib2 not support proxy on SSL connection?

Hi,

I am running the following simple code (just open connection to some
https page with proxy):

proxy= '666.179.227.666:80'
proxy=urllib2.ProxyHandler({"https":'https://'+proxy})
opener = urllib2.build_opener(proxy)
request = urllib2.Request('https://somehttpspage....')
response = opener.open(request)

And I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
File "C:\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Python24\lib\urllib2.py", line 1029, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL
routines:SSL23_GET_SERV
ER_HELLO:unknown protocol')>

Is it possible that urllib2 doesnt support for proxy over https
connections?

Thanks alot,
Itay.

May 2 '06 #1
3 3068
Am Dienstag 02 Mai 2006 23:22 schrieb itay_k:
Is it possible that urllib2 doesnt support for proxy over https
connections?


Are you sure this a proxy which is accessed by https, or rather a proxy that
supports CONNECT, and thus allows you to access https-sites? I'd guess the
latter, which I haven't gotten to work with urllib2 so far.

AFAICT, that's why you get an unknown protocol error from the SSL library,
because the proxy starts a plaintext session, and urllib2 expects an SSL
session (which you try to use to access the proxy, because you specify https
as the proxy URL), and so doesn't know what to do with the data it gets.

I'd guess you'd have to rethink what you're doing here...

--- Heiko.
May 2 '06 #2
Heiko Wundram <me*******@modelnine.org> writes:
Am Dienstag 02 Mai 2006 23:22 schrieb itay_k:
Is it possible that urllib2 doesnt support for proxy over https
connections?


Are you sure this a proxy which is accessed by https, or rather a proxy that
supports CONNECT, and thus allows you to access https-sites? I'd guess the
latter, which I haven't gotten to work with urllib2 so far.

[...]

There's a patch on SF that implements this (CONNECT), but it's fairly
nasty and would need rewriting to get into the stdlib.
John

May 3 '06 #3
Heiko Wundram <me*******@modelnine.org> writes:
Am Dienstag 02 Mai 2006 23:22 schrieb itay_k:
Is it possible that urllib2 doesnt support for proxy over https
connections?


Are you sure this a proxy which is accessed by https, or rather a proxy that
supports CONNECT, and thus allows you to access https-sites? I'd guess the
latter, which I haven't gotten to work with urllib2 so far.


Also a recipe (maybe essentially the same as the SF patch, don't
remember):

http://aspn.activestate.com/ASPN/Coo.../Recipe/456195
John

May 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
21080
by: O. Koch | last post by:
Until now, i know that ftplib doesn't support proxies and that i have to use urllib2. But i don't know how to use the urllib2 correct. I found some examples, but i don't understand them. Is...
4
4441
by: bmiras | last post by:
I've got a problem using urllib2 to get a web page. I'm going through a proxy using user/password authentification and i'm trying to get a page asking for a HTTP authentification. And I'm using...
0
1420
by: Lee, Dustin | last post by:
I'm using python2.2.2 on redhat linux 7.3 Here's a snippet of what I'm trying to run: # set up proxy import urllib2 proxy_support =...
0
2130
by: Carl Waldbieser | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** When using urllib2.urlopen() on my Windows 2000 machine at work, I was puzzled that I kept getting back authentication errors from...
1
2754
by: tomazi75-nospam(at)gmail.com | last post by:
Hello all, I've a problem using urllib2 with a proxy which need authentication. I've tested the 'simple way' : -- code -- import urllib # example values for the post
6
11656
by: Alejandro Dubrovsky | last post by:
I see from googling around that this is a popular topic, but I haven't seen anyone saying "ah, yes, that works", so here it goes. How does one connect through a proxy which requires basic...
0
2429
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
4
8482
by: looping | last post by:
Hi, I have to make internet connections through an ISA proxy server that use NTLM or Kerberos authorization method. I've found a program in python called ntlmaps that act like a proxy and could...
0
1255
by: Astan Chee | last post by:
Hi, Im trying to implement the logic from http://www.hypothetic.org/docs/msn/general/http_connections.php to a simple python code using urllib2 and some parts of urllib. Im behind a http proxy...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5604
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.