April 8th, 2004, 05:57 AM
Join Date: Apr 2004
Time spent in forums: 53 m 49 sec
Reputation Power: 0
CGI with Python (on proxy with HTTPS)
I have been trying to write a Python script which would access a CGI script
on a https server behind a proxy, and I am getting nowhere.
First, the setup:
There is a proxy, where you get when entering an URL like (domainnames
(no login required)
The server I'd like to access is:
resp. the cgi script
(login required for both)
To access this server I wrote a script called query.py:
a) using urllib.urlopen('www.myproxy.com/server/cgi-gin/server.py'):
urlopen asks me for a username and a password and I can read the output of the cgi script. The problem is: I can not POST any arguments within this urlopen command (I usually have several fields and upload files as arguments, using cgi.FieldStorage() containing fields with 3 entries (name, filename, content of file)).
b) using urllib2.urlopen and ProxyHandler and HTTPBasicAuthHandler:
apart from the fact, that I don't really know what I am doing, it doesn't work.
c) using httplib.HTTP(host):
this worked perfectly, as long as the cgi was on a http server. When changing to https, the script doesn't work anymore (even if using httplib.HTTPS()).
Is there an easy way of doing this? I would prefer something like a) with a
working POST, or a c) with a login prompt like in a).
Thanks for any help.
Last edited by nyffeler : April 22nd, 2004 at 03:48 AM.