OpenSSL & Python -the Saga Continues

Ng Pheng Siong ngps at madcap.dyndns.org
Thu Aug 31 11:21:37 EDT 2000


According to  <kenzy at my-deja.com>:
> Ok... I finally installed OpenSSL and Python Correctly.  I you saw in my
> previous posting I was having some trouble. Now I want to see if you one
> has seen this error before... my code:

Dunno about your error. M2Crypto (www.post1.com/home/ngps/m2) works:

/tmp:$ cat u
#!/usr/local/bin/python
from M2Crypto import SSL, httpslib

def get_temp2():
    ctx = SSL.Context('sslv23')
    url = httpslib.HTTPS(ctx, 'login.isend.com')
    url.putrequest('GET', '/')
    url.putheader('Accept', 'text/html')
    url.putheader('Accept', 'text/plain')
    url.endheaders()
    errcode, errmsg, headers = url.getreply()
    print ("error code = %s" % errcode)
    f = url.getfile()
    data = f.read()
    f.close()
    print data

get_temp2()

/tmp:$ ./u
error code = 200
<!-- Copyright (c) 1993-1998 Tumbleweed Software Corp. All Rights Reserved. -->
<!-- File name: AccLogin.tpl --> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
	<TITLE>iSend Message Center - Account Login</TITLE>

<script language="JavaScript">
<!--
js_version=0
js_version=Math.round(parseFloat(navigator.appVersion)*1000)
//-->
</script>

</HEAD>

[ etc. etc. ]



-- 
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps




More information about the Python-list mailing list