xml-rpc example doesn't work with python 2.6
the xml-rpc example doesn't work with python 2.6:
$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> xrl = xmlrpclib.Server('http://metamark.net/api/xmlrpc')
>>> print xrl.shorten_simple('http://www.example.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <fault>
</module></stdin>
$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> xrl = xmlrpclib.Server('http://metamark.net/api/xmlrpc')
>>> print xrl.shorten_simple('http://www.example.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <fault>
</module></stdin>
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?Hi Savvas,
I'd recommend using the REST API. It does the same, but with less overhead! 99.25% of the API requests are for that.
Indeed I should just remove the examples for the XML-RPC APIs; in particular if it's not working with newer versions of Python.
Please let me know if the Python example for the REST API needs updating, too.
- ask
1 person says
this answers the question
-
Inappropriate?Cool, thanks - the API works: http://launchpad.net/surl
I was just experimenting/playing around with that rpc interface :)
Loading Profile...




EMPLOYEE