amritkrs
amritkrs

Reputation: 632

Not able to connect to https sites using urllib due to ssl error

fh = urllib.urlopen('https://docs.python.org/2/library/urllib.html',proxies=proxies)

where proxies is a dictionary as follows:

proxies['http'] = "http//user_name:password@ip:port"
proxies['https'] = "https//user_name:password@ip:port"

NOte: I have removed colon after http and https above because it is taken as a link and i am not allowed to post more than 2 links.

but i get following error:

407      def _real_connect(self, addr, return_errno):
IOError: [Errno socket error] [Errno 1] _ssl.c:510: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

I tried what was given on "Python httplib SSL23_GET_SERVER_HELLO:unknown protocol" but that gave me following error:

 407     def _real_connect(self, addr, return_errno):
 IOError: [Errno socket error] [Errno 8] _ssl.c:510: EOF occurred in violation of protocol

Now it might be because of college proxy but i have supplied it through proxies.

Upvotes: 1

Views: 4204

Answers (1)

Klaus D.
Klaus D.

Reputation: 14379

You missed the : in the URIs:

proxies['http'] = "http://user_name:password@ip:port"
proxies['https'] = "https://user_name:password@ip:port"

Upvotes: 3

Related Questions