[Tutor] Python & XML

justinstraube at charter.net justinstraube at charter.net
Thu May 6 19:21:36 EDT 2004


Ive used the httplib module and the examples given in the 2.3 docs to 
retrieve my or a given users stats from SETI,

(where XXXX is the registered email address)

The string retrieved is in XML format. Ive begun looking at the some of 
the docs for the different XML modules in 2.3 but this is a bit 
confusing. Im not sure where to start.

I am guessing that this should be a fairly simple project as the tags 
for the fields in the user stats shouldnt change. I would just need to 
extract the wanted data for display.

Can anyone can point me to anything on how to go about this?

import httplib

SETI = "setiathome2.ssl.berkeley.edu"

print = '\t\tPSETI'
usrmail = raw_input('\nYour Email Address: ')
addr = '/fcgi-bin/fcgi?cmd=user_xml&email=' + usrmail

conx = httplib.HTTPConnection(SETI)
conx.request('GET', addr)
response = conx.getresponse()
print response.status, response.reason
data = response.read()
print data

raw_input('Press Enter to continue')




More information about the Tutor mailing list