xmlrpc username/password failures

P

penglish1

Hi,

I'm trying to get xmlrpc working with usernames and passwords and
having some issues. This is on Linux (WBEL3.0R1).

First of all with python 2.2.3 which comes with WBEL the following
simple code fails (passwords & server names altered to protect the
innocent):

#!/usr/bin/python

import xmlrpclib
from xmlrpclib import *

test =
Server('http://3tier:My&[email protected]/Forecast')

print test.ReturnSimpleInt()

Returns the following error:

Traceback (most recent call last):
File "./testCondon.py", line 8, in ?
print test.ReturnSimpleInt()
File "/usr/lib/python2.2/xmlrpclib.py", line 821, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.2/xmlrpclib.py", line 975, in __request
verbose=self.__verbose
File "/usr/lib/python2.2/xmlrpclib.py", line 833, in request
h = self.make_connection(host)
File "/usr/lib/python2.2/xmlrpclib.py", line 862, in make_connection
return httplib.HTTP(host)
File "/usr/lib/python2.2/httplib.py", line 969, in __init__
self._setup(self._connection_class(host, port, strict))
File "/usr/lib/python2.2/httplib.py", line 491, in __init__
self._set_hostport(host, port)
File "/usr/lib/python2.2/httplib.py", line 502, in _set_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port:
'My&[email protected]'

Strangely enough, the URL is not considered invalid by Python 2.4
(compiled fresh on WBEL), but I get 401 Unauthorized even though I can
cut/paste the URL into my browser (firefox 1.0) and I'm given
access...so I *know* it is not a typo:

Traceback (most recent call last):
File "./testCondon.py", line 8, in ?
print test.ReturnSimpleInt()
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1137, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for
3tier:My&[email protected]/Forecast: 401 Unauthorized>

The _only_ thing I was able to find in google about this is this one
bug:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=944396&group_id=5470

which seems to indicate that username:password@hostname is not
*actually* an RFC valid syntax. However the xmlrpclib documenation
clearly indicates that that is *the* syntax to use:

http://docs.python.org/lib/module-xmlrpclib.html

What gives? What is the "right" way to do it?

Thanks,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top