This is a code for posting on a blog. It is my first try. I dont know what is the error in it. I am using proxy server and the error I’m getting is connection to server failed.
Can anyone help me out pleaseeeeeeeeee :/
import wordpresslib
# dummy data to be on safe side
data = "Post content, just ensuring data is not empty"
url='http://agneesa.wordpress.com/wordpress/xmlrpc.php'
# insert correct username and password
wp=wordpresslib.WordPressClient(url,'agnsa','pan@13579')
wp.selectBlog(0)
post=wordpresslib.WordPressPost()
post.title='try'
post.description=data
idPost=wp.newPost(post,True)
here is the traceback
here is the traceback file
Traceback (most recent call last):
File "C:Python27Libexample.py", line 34, in <module>
post.categories = (wp.getCategoryIdFromName('Python'),)
File "C:Python27Libwordpresslib.py", line 332, in getCategoryIdFromName
for c in self.getCategoryList():
File "C:Python27Libwordpresslib.py", line 321, in getCategoryList
self.user, self.password)
File "C:Python27Libxmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "C:Python27Libxmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "C:Python27Libxmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "C:Python27Libxmlrpclib.py", line 1292, in single_request
self.send_content(h, request_body)
File "C:Python27Libxmlrpclib.py", line 1439, in send_content
connection.endheaders(request_body)
File "C:Python27Libhttplib.py", line 954, in endheaders
self._send_output(message_body)
File "C:Python27Libhttplib.py", line 814, in _send_output
self.send(msg)
File "C:Python27Libhttplib.py", line 776, in send
self.connect()
File "C:Python27Libhttplib.py", line 757, in connect
self.timeout, self.source_address)
File "socket.py", line 571, in create_connection
raise err
error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
From the looks of your site, the url you posted returns a 404 (not actually there). However, this does seem ready to receive POST requests: http://agneesa.wordpress.com/xmlrpc.php
I suggest you try checking that URL for accuracy.
This is what I get when I try your code with your original URL:
This is what I get when I try it with the modified URL:
… obviously because thats not your real account info. In a nutshell, its possible your proxy could also be contributing to problems if its not set up to properly forward the request, but without us knowing specifics about your proxy config, there is no way to know for sure.