top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Error with python 3.3.2 and https

0 votes

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 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 ='')
posted May 23, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn 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 ='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.

When I followed the instructions I got that it wasn't supported, although the 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/ checks for.
In Python 3.3's Lib/ 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.

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

0 votes

I'm trying to setup a forward proxy to access certain endpoints on Remote server which require https with basic authentication in header.

A(Application server) ---> Forward proxy (B) ----> Remote server(C)

i'm at B on which i have setup below Apache Virtual host in which i'm setting the headers to use basic authentication passing encoded value of user & pass configured on remote server.However,i want to include HTTPS in my request to C to ensure the headers are sent securely with encrption to remote server (C). I do Not want to use a separate Virtual host for HTTPS. Should i include a SSL Server certificate in my proxy configuration as given below with the basic authentication in header ?
How can i achieve this in Single virtual host ? I have limited knowledge on apache, so please help here.

I tried searching on the internet but did not find the required solution.

##### vHost 9099 is for basic auth with HTTPS #####
Listen *:9099
<VirtualHost *:9099>

        DocumentRoot    /my/doc/root/
        SSLEngine on
        RewriteEngine On
        AllowEncodedSlashes NoDecode

        ProxyRequests On

        # SSL configuration

        SSLCertificateFile       /Path to cert.pem
        SSLCertificateKeyFile    /Path to private key
        SSLCACertificateFile     /Path to CA certs

        ##  Basic64  Encoded XXXX od user and passwd in header

         RequestHeader set Authorization "Basic XXXXX"

         ##  Endpoints accessed via https with basic authentication in header

         ProxyPass /api/api1/
         ProxyPassReverse /api/api1/

+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?

+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.

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