[Zope] xml-rpc client for zope w/cookie authentication

Erik Myllymaki Erik Myllymaki <erik.myllymaki@pacific-shores.com>
Wed, 31 Jul 2002 09:48:02 -0700


Seems I didn't really describe my problem too well. I will exand on it.

xmlrpclib supports basic authentication, but what if you are using something
else, like loginmanager or exuserfolder or...

unprotected_stuff is a DTML Doc that doesn't require login.
protected_stuff is a DTML Doc that DOES require login.

------------ Begin client code ----------------------------------------
import xmlrpclib

s=xmlrpclib.Server("http://192.168.1.2:9090")

print s.unprotected_stuff()

OUTPUT>> <html><head></head><body>
OUTPUT>> this is the unprotected stuff page.
OUTPUT>> </body>
OUTPUT>> </html>

print s.protected_stuff()

OUTPUT>>
Traceback (most recent call last):
  File "V:\Python21\Pythonwin\pywin\framework\scriptutils.py", line 301, in
RunScript
    exec codeObject in __main__.__dict__
  File "M:\python\xml_tester.py", line 14, in ?
    print s.protected_stuff()
  File "V:\Python21\xmlrpclib.py", line 660, in __call__
    return self.__send(self.__name, args)
  File "V:\Python21\xmlrpclib.py", line 809, in __request
    verbose=self.__verbose
  File "V:\Python21\xmlrpclib.py", line 692, in request
    return self.parse_response(h.getfile())
  File "V:\Python21\xmlrpclib.py", line 731, in parse_response
    return u.close()
  File "V:\Python21\xmlrpclib.py", line 439, in close
    raise apply(Fault, (), self._stack[0])
Fault: <Fault -2: 'Unexpected Zope error value: <html>\n<head><title>Please
log in.</title>...The rest of my login page here...</body></html>'>
>>
------------ End client code ------------------------------------------


I guess, after looking at it a little further, the xmlrpc server code used
by zope would have to be changed to deal with this.
I have used urrlib or httplib with cookies, so I guess I will have to merge
that into the xmlrpc server code w/Zope somehow...



----- Original Message -----
From: "Chris Withers" <chrisw@nipltd.com>
To: "Erik Myllymaki" <erik.myllymaki@pacific-shores.com>
Cc: <zope@zope.org>
Sent: Wednesday, July 31, 2002 2:04 AM
Subject: Re: [Zope] xml-rpc client for zope w/cookie authentication


> Erik Myllymaki wrote:
> > Like the subject says, I am looking to make a command-line-based xml-rpc
> > client (in python) to talk to my zope server.
>
> A what? Not sure exactly what you're expecting. Maybe you want
xmlrpclib.py?
>
> > I am using SMB auth via
> > loginmanager so would need to work in the cookie authentication somehow.
>
> Urm?
>
> Chris
>