1

I'm trying to ping Pingomatic using python.

I've written this:

import xmlrpclib

print "START"

s = xmlrpclib.Server('http://rpc.pingomatic.com')
reply = s.weblogUpdates.ping('Test','http://www.testblog.com')

print "END"

But when I run, i get:

>>> 
START

Traceback (most recent call last):
  File "C:/xxxxxxxxxxxxxxxxxx/pingtest1.py", line 6, in <module>
    reply = j.weblogUpdates.ping('Test','http://www.testblog.com')
  File "C:\Python27\lib\xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "C:\Python27\lib\xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "C:\Python27\lib\xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Python27\lib\xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "C:\Python27\lib\xmlrpclib.py", line 1462, in parse_response
    p.feed(data)
  File "C:\Python27\lib\xmlrpclib.py", line 557, in feed
    self._parser.Parse(data, 0)
ExpatError: syntax error: line 1, column 0
>>> 

How can I fix this?

Thank you.

5
  • Maybe s = xmlrpclib.Server('http://rpc.weblogs.com/RPC2')? Commented Dec 13, 2010 at 17:36
  • @khachik it works with weblogs, but it doesn't with pingomatic Commented Dec 13, 2010 at 18:10
  • ExpatError: syntax error: line 1, column 0 means that it didn't get an XML response (or any response). You might want to check pingomatic's API. Commented Dec 13, 2010 at 18:16
  • @khachik In PHP+Kohana, it worked fine (I'm trying to port to python). My code is: $content= xmlrpc_encode_request('weblogUpdates.ping', array($title,$url)); $header = array( 'Content-Type: text/xml', 'Content-Length: '.strlen($content), '\r\n' ); $result = Remote::get($target, array( CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $content, CURLOPT_HTTPHEADER => $header )); return xmlrpc_decode($result); Commented Dec 13, 2010 at 18:31
  • Did you ever solve this issue? If so, it would be great if you could post the solution here, as I'm running into the exact same problem. Thanks! Commented Aug 7, 2011 at 18:43

1 Answer 1

1

It turns out this was an issue with Pingomatic's response format. I tried pinging Weblogs.com, and it worked fine.

I emailed Automattic to let them know, and they've since fixed the issue -- everything should be working!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.