Hi Petr, use the attached xmlrpcauth.py file as follows: --------------------------- import xmlrpcauth import xmlrpclib mytransport = xmlrpcauth.BasicAuthTransport("username","password"); rpcserver = xmlrpclib.Server("http://hostname:portnumber/",mytransport); print rpcserver.echo("Hello World!"); --------------------------- This was done using the 0.9.8 of xmlrpclib.py available from http://www.pythonware.com/products/xmlrpc/ (well they have 0.9.9 by now ...) It does not support https as of now but does basic user authentication (in the http header). If you change the xmlrpcauth file to use a https-able lib instead of the httlib imported at the very first line of the xmlrpcauth.py file: --- import string, xmlrpclib, httplib --- then you will be able to use ssl encrpyted http. - Holger Am Dienstag, 1. Mai 2001 20:19 schrieb Michel Pelletier:
On 27 Apr 2001, Petr Knapek wrote:
Hi Zopists, does anybody of you know how to do "subject" in Zope 2.3.0 (2.3.1) on Linux Debian.
I have already installed M2Crypto but do not know how to use it. When I tried this in python:
from M2Crypto import xmlrpclib2 s = xmlrpclib2.Server("https://uid:password@host/") print s.index_html()
this error is returned:
print s.index_html()
Traceback (innermost last): File "<stdin>", line 1, in ? File "/usr/lib/zope/lib/python/xmlrpclib.py", line 547, in __call__ return self.__send(self.__name, args) File "/usr/lib/zope/lib/python/xmlrpclib.py", line 630, in __request request File "/usr/lib/zope/lib/python/xmlrpclib.py", line 560, in request h = httplib.HTTP(host) File "/usr/lib/python1.5/httplib.py", line 51, in __init__ if host: self.connect(host, port) File "/usr/lib/python1.5/httplib.py", line 75, in connect raise socket.error, "nonnumeric port" socket.error: nonnumeric port
Can anybody help me?
xmlrpclib does not understand the uid:password@url syntax. This is not how you do authentication with xmlrpclib, you need to subclass and create your own transport. The new xmlrpclib should come with a transport that supports Basic authentication. See the xmlrpclib sources or the xmlrpclib mailing list for more info.
-Michel
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ----------------------------------- catWorkX GmbH Dipl.-Ing. Holger Lehmann Stresemannstr. 364 22761 Hamburg Tel: +49 (0700) catWorkX Tel: +49 (40) 890 646-0 Fax: +49 (40) 890 646-66 mailto:lehmann@catworkx.de http://www.catworkx.de http://www.catbridge.de