xmlrpc username/password failures

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • penglish1@gmail.com

    #1

    xmlrpc username/password failures

    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&Passw6 @www.server.net/Forecast')

    print test.ReturnSimp leInt()

    Returns the following error:

    Traceback (most recent call last):
    File "./testCondon.py", line 8, in ?
    print test.ReturnSimp leInt()
    File "/usr/lib/python2.2/xmlrpclib.py", line 821, in __call__
    return self.__send(sel f.__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_conne ction(host)
    File "/usr/lib/python2.2/xmlrpclib.py", line 862, in make_connection
    return httplib.HTTP(ho st)
    File "/usr/lib/python2.2/httplib.py", line 969, in __init__
    self._setup(sel f._connection_c lass(host, port, strict))
    File "/usr/lib/python2.2/httplib.py", line 491, in __init__
    self._set_hostp ort(host, port)
    File "/usr/lib/python2.2/httplib.py", line 502, in _set_hostport
    raise InvalidURL("non numeric port: '%s'" % host[i+1:])
    httplib.Invalid URL: nonnumeric port:
    'My&Passw6@sd-portal.prasenti a.net'

    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.ReturnSimp leInt()
    File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
    return self.__send(sel f.__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.Proto colError: <ProtocolErro r for
    3tier:My&Passw6 @www.server.net/Forecast: 401 Unauthorized>

    The _only_ thing I was able to find in google about this is this one
    bug:
    https://sourceforge.net/tracker/?fun...&group_id=5470

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

    Source code: Lib/xmlrpc/client.py XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a transport. With it, a client can call methods with parameters on a remote server (t...


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

    Thanks,
    Paul

Working...