1
0
Fork 0

wordpress-xmlrpc: download unlimited comments

This commit is contained in:
Aleix Conchillo Flaque 2010-12-23 03:14:59 +01:00 committed by Andy Wingo
parent fc07af26f6
commit 736a074097

View file

@ -12,6 +12,8 @@ import xmlrpclib
from HTMLParser import HTMLParser from HTMLParser import HTMLParser
MAX_POST_NO = 10000
class WordPress: class WordPress:
def __init__(self, url, username, password): def __init__(self, url, username, password):
@ -20,7 +22,6 @@ class WordPress:
self.__proxy = xmlrpclib.ServerProxy(url) self.__proxy = xmlrpclib.ServerProxy(url)
def all_posts(self): def all_posts(self):
MAX_POST_NO = 10000
return self.__proxy.metaWeblog.getRecentPosts("", return self.__proxy.metaWeblog.getRecentPosts("",
self.__username, self.__username,
self.__password, self.__password,
@ -30,7 +31,8 @@ class WordPress:
return self.__proxy.wp.getComments("", return self.__proxy.wp.getComments("",
self.__username, self.__username,
self.__password, self.__password,
{"post_id" : post["postid"]}) {"post_id" : post["postid"],
"number": MAX_POST_NO})
class MyHTMLParser(HTMLParser): class MyHTMLParser(HTMLParser):