[OGo-XML-RPC] Pyhton 2.4

Adam Tauno Williams xmlrpc@opengroupware.org
Wed, 10 May 2006 08:49:34 -0400


--=-0gZlsN4tkPFKK+62Ggvt
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2006-05-10 at 14:28 +0200, Helge Hess wrote:
> On 10. Mai 2006, at 13:18 Uhr, Adam Tauno Williams wrote:
> > Anyone have an example of a Python->OGo XML-RPC call using a modern
> > Python 2.4?
> http://docs.python.org/lib/module-xmlrpclib.html
> > scripts like -
> > http://bugzilla.opengroupware.org/bugzilla/attachment.cgi?=20
> > id=3D410&action=3Dview - no longer work.
> Si. I think you where using the old replacement xmlrpclib provided by =20
> OGo. With Python 2.0 or so the parameters changed.

I think so.

> > server =3D xmlrpclib.Server(sys.argv[1],sys.argv[2],sys.argv[3])
> > - then it fails with -
> > AttributeError: 'str' object has no attribute 'request'
> I think this is because either the second or the third arguments =20
> should not be strings.
> If I understand it right it should be just:
>    s =3D xmlrpclib.Server("http://user:passwd@localhost/RPC2")
> This works for me (Debian Python 2.3).

Yep, this works -=20

#!/usr/bin/env python

import xmlrpclib
server =3D
xmlrpclib.Server('http://{username}:{password}@{hostname}/RPC2')
person =3D server.person.getById("10100");
print(person["url"])
person["url"] =3D ""
person =3D server.person.update(person)
print(person["url"]

--- producing the output ---
awilliam@aleph:~> ./test.py
http://www.whitemice.org
http://www.whitemice.org
-- which is a test case of Bug#1723

--=-0gZlsN4tkPFKK+62Ggvt
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBEYeFeLRePpNle04MRAl2oAJ42KCfv7djP9qrX1NqrVXxVWXzxAQCeKAob
9/FR18lfu7208VPGANLAcMY=
=M4jf
-----END PGP SIGNATURE-----

--=-0gZlsN4tkPFKK+62Ggvt--