top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Error with python 3.3.2 and https

0 votes
170 views

I am trying to write a program that requires me hitting a https web link. However, I can't seem to get it to work. The program works fine when dealing with http sites, however, when I try it with a https site I get

socket.gaierror: [Errno 11001] getaddrinfo failed

It seems like it has something to do with the ssl not working, however, I do have the ssl.py in the python library and I have no problem importing it.

My code is below. Any help would be greatly appreciated.

import urllib.request
auth = urllib.request.HTTPSHandler()
proxy = urllib.request.ProxyHandler({'http':'my proxy'})
opener = urllib.request.build_opener(proxy, auth)
f = opener.open('http://www.google.ca/')
posted May 23, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

2 Answers

+1 vote
 
Best answer

Can you post working code for HTTP and nonworking for HTTPS? There was no SSL in the code you posted. Or are you saying it's really just that you change the URL and it stops working? If so, I don't think we can test it without having your proxy... you may want to talk to whoever controls the proxy.

answer May 23, 2013 by anonymous
Yeah that is the case. Once I change the f = opener.open('website') line to a link that has a https I get that socket error. Nothing else changes. I was reading online and came across this site which shows you how if the version of python installed supports ssl.

http://morlockhq.blogspot.ca/2008/05/python-tip-checking-to-see-if-your.html

When I followed the instructions I got that it wasn't supported, although the ssl.py is in the lib directory. Python was installed from the official python page using the windows installer. Is somehow ssl disabled by default? Do I need to get a third party ssl module?
Unfortunately those instructions don't work for Python 3... or at least, if they do, then both of my handy installations (one Windows, one Linux) don't have SSL. However, I *can* do 'import ssl' and 'import _ssl', the latter of which is what Lib/socket.py checks for.
In Python 3.3's Lib/socket.py there's no mention of ssl anywhere, so I'd be inclined to look elsewhere for support checks.
0 votes

Check the name of your proxy; maybe you can't resolve it. Can you identify your proxy by IP address? By omitting the proxy part, I can quite happily make a direct request using code like yours.

answer May 23, 2013 by anonymous
Similar Questions
0 votes

I am trying to make an HTTPS connection and read that HTTPS support is only available if the socket module was compiled with SSL support.

http://www.jython.org/docs/library/httplib.html

Can someone elaborate on this? Where can I get the socket module for HTTPS, or how do I build one if I have to?

+2 votes

I am working on drawing map from shape file in Python 3.2 basemap. But, the longitude values at the bottom axis are only shown partially. Also, all latitude values are missing.

Here is my python code.

import shapefile as sf
import sys
import numpy as np
import matplotlib.pylab as plt
from mpl_toolkits.basemap import Basemap

 map = Basemap(projection='stere', lon_0=-106.4, lat_0= 31.9, lat_ts = 31.9, 
 llcrnrlat=31.7, urcrnrlat= 31.85, 
 llcrnrlon=-106.5 , urcrnrlon= -106.1, 
 rsphere=6371200., resolution='l', area_thresh=1000)

 plt.figure(num=None, figsize=(10, 8), dpi=80, facecolor='w', edgecolor='k')

parallels = np.arange(31.7, 31.85, 0.25)

map.drawparallels(parallels, labels=[0, 0, 0, 1] , fontsize=10, labelstyle='+/-', dashes=[2, 2])

meridians = np.arange (-106.5, -106.1, 0.25)

map.drawmeridians(meridians, labels=[0, 0, 0, 1], fontsize=10, labelstyle='+/-' , dashes=[2, 2])

No matter how I changed the labels, the latitude/longitude legend values are still missing.

+2 votes

I can not find a resolution on bugzilla's doc about how to install bugzilla with https. By default, the bugzilla installation will be access with http://, not https://

If I want to access use https://, is there any package or software additional should be installed first? Or I can just configure on Bugzilla's parameter: SSL_Redirect and sslbase, and no need to change with bugzilla installation?

0 votes

How do I get a valid certificate for a box that is behind a firewall and does not have a DNS entry?

I was looking at letsencrypt.org but currently it looks like a valid DNS entry is needed, of which I don't have.

There is nothing special about my setup, its just a box that is not directly on the internet, no DNS entry but I need HTTPS to run correctly.

How do I generate a trusted certificate base on IP or something?

How can I do that? Thanks,

0 votes

I have Intranet access to SVN/DAV over HTTPS and it works fine.

Now I need to open it up to external access, using mod_proxy_html to forward requests to the /repos/ path to the SVN server from our corporate server (which is where we port-forward 80 and 443 from the outside).

I've been playing with this a couple of hours, but can't get it to work.

In particular, the mod_proxy_html doesn't seem to know what to do with methods like OPTIONS from what I can decipher.

Anyone does this before? Or have any ideas how to do it?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...