maintaince tools for sfjp magazine
Revision | 18485328b7f68a9a533620d06a857452f5dbca9a (tree) |
---|---|
Time | 2017-07-18 19:19:17 |
Author | hylom <hylom@hylo...> |
Commiter | hylom |
fix some codes
@@ -30,9 +30,9 @@ class CookieTransport(xmlrpclib.SafeTransport): | ||
30 | 30 | |
31 | 31 | response = h.getresponse() |
32 | 32 | |
33 | - print response.status | |
33 | + print >> sys.stderr, response.status | |
34 | 34 | for hv in response.getheaders(): |
35 | - print hv[0] + ": " + hv[1] | |
35 | + print >> sys.stderr, hv[0] + ": " + hv[1] | |
36 | 36 | #print response.read() |
37 | 37 | for header in response.msg.getallmatchingheaders("Set-Cookie"): |
38 | 38 | val = header.split(": ", 1)[1] |
@@ -76,6 +76,14 @@ class MagClient(object): | ||
76 | 76 | user_id, |
77 | 77 | fields) |
78 | 78 | |
79 | + def edit_post(self, post_id, content): | |
80 | + proxy = self._get_proxy() | |
81 | + return proxy.wp.editPost(self._get_blog_id(), | |
82 | + self.username, | |
83 | + self.password, | |
84 | + post_id, | |
85 | + content) | |
86 | + | |
79 | 87 | def new_post(self, content): |
80 | 88 | proxy = self._get_proxy() |
81 | 89 | return proxy.wp.newPost(self._get_blog_id(), |
@@ -114,4 +122,4 @@ class MagClient(object): | ||
114 | 122 | filter) |
115 | 123 | except xmlrpclib.Fault, e: |
116 | 124 | # print "error {0}: {1}".format(e.faultCode, e.faultString.encode('utf8')) |
117 | - print "error %s: %s" % (e.faultCode, e.faultString.encode('utf8')) | |
125 | + print >> sys.stderr, "error %s: %s" % (e.faultCode, e.faultString.encode('utf8')) |