473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HTTPS won't work, no matter which lib and how.

Hi.
I'm having some anoying trouble trying to establish a https connection.
I've even switched Python Versions (from 2.2.3 to 2.3.3), but the Errors
remain basically the same, allthough they now come in nice XML :-).

Here are some examples:

My last desperate try (which is way off the book):
import re
import base64
import httplib
import urllib2
import string
# don't know if I need this one, it doesn't fix anything it seems...
import socket

suffix = r"blah"
prefix = r"jada"

basicAuth = base64.encodestring(prefix + r":" + suffix)

kopf = {"Basic": basicAuth}

req = urllib2.Request(url="https://myurl/", data="", headers = kopf)
fileLines = urllib2.https_open(req)
print "Recieved:"
print fileLines
<<<
This is the Error it throws:
./gethttps.py
Traceback (most recent call last):
File "./gethttps.py", line 30, in ?
fileLines = urllib2.https_open(req)
AttributeError: 'module' object has no attribute 'https_open'
The obvious one doesn't work either ALTHOUGH it's an Example from the
official urllib2 docs!!!:

import re
import base64
import httplib
import urllib2
import string
import socket

suffix = r"blah"
prefix = r"jada"

basicAuth = base64.encodestring(prefix + r":" + suffix)

kopf = {"Basic": basicAuth}

req = urllib2.Request(url="https://myurl/", data="", headers = kopf)

fileLines = urllib2.urlopen(req)

print "Recieved:"
print fileLines
<<<
Here are the Errors throwed:
Traceback (most recent call last):
File "./gethttps.py", line 25, in ?
fileLines = urllib2.urlopen(req)
File "/usr/local/lib/python2.3/urllib2.py", line 129, in urlopen
return _opener.open(url, data)
File "/usr/local/lib/python2.3/urllib2.py", line 331, in open
'unknown_open', req)
File "/usr/local/lib/python2.3/urllib2.py", line 306, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.3/urllib2.py", line 914, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: https>

Does anybody have any Idea how I can open a https connection using
Python? The http, urllib and urllib2 in a whole seem quite a messy bunch
and I have had no success so far trying to grasp how to handle large
parts of them.
There are traces on the web saying that some socket stuff needs ssl
compiled into them in order for https stuff to work, but they seem old
and since I'm using the fresh original sources from www.python.org on a
Debian Linux system I presume that compiling should work A-OK.
If anybody thinks this is likeley to be a compiling issue, how and where
do I change the original source distribution to support https? In some
make or configure file maybe? I have no Idea. How do I find out if ssl
is supported in my install?
I'd be glad if someone could help, this all is driving me nuts.

Thanks.

Phillip

BTW: Since there is apsolutely no documentation on how to use the larger
part of urllib2's stuff on python.org it would be nice if someone could
also point out a howto or some working examples of how and in which
situations to use these classes and methods, such as OpenerDirector(???)
and such.
Jul 18 '05 #1
1 3434
On 2004-05-17, Phillip <fo*******@no-spam.com> wrote:
Hi.
I'm having some anoying trouble trying to establish a https connection.
I've even switched Python Versions (from 2.2.3 to 2.3.3), but the Errors
remain basically the same, allthough they now come in nice XML :-).

Maybe this will help...

http://aspn.activestate.com/ASPN/Coo.../Recipe/267197

Jul 18 '05 #2

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

Similar topics

9
by: Troot | last post by:
Hi all, In mind this is a daft question, but here goes. My hosts allow secure https logins on specific directories. What I want to do is have a login screen in flash, if the user enters the...
16
by: Paul Sweeney | last post by:
Does anyone know of a working (python) https proxy which allows viewing of unencrypted data being sent from my browser to an https site? I've worked my way through most on the list at...
1
by: Cindy Lee | last post by:
I'm trying to dynamically set the height of my Iframe. my https: main page is calling another https in an Iframe. But i get an access denied error from my javascript trying to call the parent...
14
by: Peter Chant | last post by:
I'm currently authenticating a site I have built using basic http authentication built into apache. This has zero overhead on php which is a bonus but it seems to not quite work how I'd like. ...
2
by: Gareth | last post by:
Hello Why can't I run ASPX in SSL mode? i.e. I am developing locally (local IIS server) then uploading to a web site. The non-secure pages run okay. but when a link to an https page is...
7
by: Richard L Rosenheim | last post by:
Anyone care to express their two cents over pros and cons of encrypting the data being transmitted (within the SOAP package) versus just utilizing a HTTPS connection? Richard Rosenheim
1
by: batista | last post by:
Hi, I'm using webservice.htc to call a non-secure(without https) webservice method from a webpage. Now, if the webpage is not under https then everything works fine. But, when enable ssl in...
2
by: patilj | last post by:
OK, here's the deal. Let's say I got a website called: https://www.blah.com/~account/application/login.php When the user arrives they see a https which is more secure than just http alone....
4
by: bkasmai | last post by:
My asp.net application (developed using vs2003) runs fine on a windows 2000 server using iis 5.0. Our network manager wants to do away with any http connections and only use https for services that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.