|
From: | Lyu Abe |
Subject: | Re: [Demexp-dev] Questions |
Date: | Thu, 18 Oct 2007 18:53:03 +0900 |
User-agent: | Thunderbird 2.0.0.6 (Windows/20070728) |
David,
-----begin Python example----- #!/usr/bin/python from xmlrpclib import * import sys login = "demo" password = "demo" url = "http://www.linux-france.org/cgi-bin/demexp-xmlrpc-demo" print "Connect to server '%s'" % url s = ServerProxy(url) print "login()" cookie = s.login(login, password) print " => %s" % cookie print "max_question_id()" max_question_id = s.max_question_id(cookie) print " => %s" % max_question_id print "goodbye()" s.goodbye(cookie) -----end Python example----- Do you really want to use PHP? :-)
You're right, python is MUCH simpler (at least for me :P). I could achieve what I wanted, i.e. getting all needed infos from the server, and retrieving questions, etc...
However, I am using WAMP under windows and I had to install mod python in order to make it work with it. My python code (login.py) is attached as login.zip. Please take a look at it. I'm not sure what "handlers" are, but I need them to have my code work: is this cross-platform?
Also, I tried to retrieve the "login" and "password" from the initial index.html using "import cgi":
import cgi form = cgi.FieldStorage() if form.has_key["login"] ... But it didn't seem to work. Any suggestions? Lyu
login.zip
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |