[Tutor] xml

D. Hartley denise.hartley at gmail.com
Wed May 25 00:40:50 CEST 2005


I looked at the page for ElementTree that Max sent out, but I can't
understand what it's even talking about. Looking through the python
modules it seems like I need xmlrpclib - I created a serverproxy
instance, which I want to use to talk to a server - to send it
information (in this case, a name), and return to me its response.  I
can follow the documentation far enough to create a ServerProxy
instance, but then don't know what to do with it (it starts talking
about the reserved system member, and so on).

I don't want to have to know everything about xml (yet), I just want
to be able to use a phonebook which processes information in xml
(forgive my probably erroneous wording of things).  It said: "The
returned instance is a proxy object with methods that can be used to
invoke corresponding RPC calls on the remote server. If the remote
server supports the introspection API, the proxy can also be used to
query the remote server for the methods it supports (service
discovery) and fetch other server-associated metadata." - and that
sounds like what I want. Perhaps I am wrong?

Also, when I read the ElementTree page, it talked about element
instances and adding "code to load SML files as trees of Element
objects, and save them back again" - as often happens to me (and, I
hope to other beginners), this explanation does not even tell me if it
does the same thing, or anything remotely related to what I am looking
for.

Is anyone familiar with xmlrpclib, or knows of documentation that is
easier to follow than that in the library about how to use its
methods?

Also, re: using passwords and usernames in urls, I saw in this library
the following:

"Both the HTTP and HTTPS transports support the URL syntax extension
for HTTP Basic Authentication: http://user:pass@host:port/path. The
user:pass portion will be base64-encoded as an HTTP `Authorization'
header, and sent to the remote server as part of the connection
process when invoking an XML-RPC method. You only need to use this if
the remote server requires a Basic Authentication user and password."

I read that the user:pass was an undocumented feature of, I think,
urllib (I may be wrong on this one), and as such, I was wondering if
anyone knew how to format the url so it automatically passed in the
username/password, like:

http://myname:mypass/www.mysite.com

does not work - but I dont know a "host" or "port" .... ?

Any ideas/suggestions/pointers would be appreciated! (sorry if I dont
understand some of the pointers you have already sent! some of the
documentation is not always user-friendly for beginners!)

Thanks again,
Denise




On 5/24/05, jfouhy at paradise.net.nz <jfouhy at paradise.net.nz> wrote:
> Quoting "D. Hartley" <denise.hartley at gmail.com>:
> 
> > anyone have a pointer to a *SIMPLE* intro to xml as used in python? I
> > looked in the library and there are about 11 xml-related modules.
> >
> > Perhaps something.... 'remote'..... ;)
> 
> Use ElementTree!
> 
> (google for it)
> 
> --
> John.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list