• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

maintaince tools for sfjp magazine


Commit MetaInfo

修订版08b76a4084dc558885978a7f5aa051d8beacd859 (tree)
时间2013-04-12 19:47:17
作者hylom <hylom@hylo...>
Commiterhylom

Log Message

add get_user method

更改概述

差异

--- a/sfjpmagclient/sfjpmagclient.py
+++ b/sfjpmagclient/sfjpmagclient.py
@@ -26,6 +26,14 @@ class MagClient(object):
2626 def _get_proxy(self):
2727 return xmlrpclib.ServerProxy(self.uri)
2828
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+
2937 def get_users_blogs(self):
3038 proxy = self._get_proxy()
3139 return proxy.wp.getUsersBlogs(self.username, self.password)
--- a/test/test_getposts.py
+++ b/test/test_getposts.py
@@ -1,6 +1,7 @@
11 #!/usr/bin/python
22 # -*- coding: utf-8 -*-
33
4+import json
45 import sys
56 sys.path.append('.')
67
@@ -15,6 +16,7 @@ auth_pass = config["auth_pass"]
1516 c = MagClient(username, password, auth_user, auth_pass)
1617 ret = c.get_posts(dict(number=10))
1718 print len(ret)
19+print ret[0]
1820 for item in ret:
1921 print item["post_title"], item["link"]
2022