maintaince tools for sfjp magazine
Revision | 08b76a4084dc558885978a7f5aa051d8beacd859 (tree) |
---|---|
Zeit | 2013-04-12 19:47:17 |
Autor | hylom <hylom@hylo...> |
Commiter | hylom |
add get_user method
@@ -26,6 +26,14 @@ class MagClient(object): | ||
26 | 26 | def _get_proxy(self): |
27 | 27 | return xmlrpclib.ServerProxy(self.uri) |
28 | 28 | |
29 | + def get_user(self, user_id, fields=[]): | |
30 | + proxy = self._get_proxy() | |
31 | + return proxy.wp.getUser(self._get_blog_id(), | |
32 | + self.username, | |
33 | + self.password, | |
34 | + user_id, | |
35 | + fields) | |
36 | + | |
29 | 37 | def get_users_blogs(self): |
30 | 38 | proxy = self._get_proxy() |
31 | 39 | return proxy.wp.getUsersBlogs(self.username, self.password) |
@@ -1,6 +1,7 @@ | ||
1 | 1 | #!/usr/bin/python |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | |
4 | +import json | |
4 | 5 | import sys |
5 | 6 | sys.path.append('.') |
6 | 7 |
@@ -15,6 +16,7 @@ auth_pass = config["auth_pass"] | ||
15 | 16 | c = MagClient(username, password, auth_user, auth_pass) |
16 | 17 | ret = c.get_posts(dict(number=10)) |
17 | 18 | print len(ret) |
19 | +print ret[0] | |
18 | 20 | for item in ret: |
19 | 21 | print item["post_title"], item["link"] |
20 | 22 |