7 wp = wordpresslib.WordPressClient('http://localhost:16081/blog/xmlrpc.php', 'michele', '010779')
\r
10 print '========================= newPost ========================='
\r
11 p = wordpresslib.WordPressPost()
\r
12 p.categories = (wp.getCategoryIdFromName('Progetti-'),)
\r
16 print '========================= getUserInfo ========================='
\r
17 user = wp.getUserInfo()
\r
18 print 'userid:', user.id
\r
19 print 'firstName:', user.firstName
\r
20 print 'lastName:', user.lastName
\r
21 print 'nickname:', user.nickname
\r
22 print 'email:', user.email
\r
24 print '========================= getUsersBlogs ========================='
\r
25 blogs = wp.getUsersBlogs()
\r
27 print 'blogId:', blog.id
\r
28 print 'name:', blog.name
\r
29 print 'url:', blog.url
\r
30 print 'isAdmin:', blog.isAdmin
\r
33 print '========================= getRecentPosts ========================='
\r
34 for post in wp.getRecentPosts(3):
\r
35 print '%d => %s' % (post.id, post.title)
\r
37 print '========================= getCategoryList ========================='
\r
38 categories = list(wp.getCategoryList())
\r
39 for i in categories:
\r
40 print '%d , %s , %d' % (i.id, i.name, i.isPrimary)
\r
42 print '========================= newPost ========================='
\r
45 p.description = 'Testo prova del gatto !!!!'
\r
46 p.categories = (wp.getCategoryIdFromName('Progetti'),)
\r
47 idNewPost = wp.newPost(p, False)
\r
52 print '========================= publishPost ========================='
\r
53 print wp.publishPost(idNewPost)
\r
55 print '========================= getPost ========================='
\r
56 post = wp.getPost(idNewPost)
\r
57 print '%d %s %s' % (post.id, post.title, post.date)
\r
59 print '========================= editPost ========================='
\r
61 p.title = 'Azzo (modificato)'
\r
63 now = datetime.datetime.now()
\r
64 p.date = (now + datetime.timedelta(days=1)).timetuple()
\r
67 p.description = 'Testo prova del gatto !!!!'
\r
68 p.categories = map(wp.getCategoryIdFromName, ('Python', 'Progetti'))
\r
69 wp.editPost(idNewPost, p, True)
\r
71 print '========================= getPost ========================='
\r
72 post = wp.getPost(idNewPost)
\r
73 print '%d %s %s' % (post.id, post.title, post.date)
\r
76 print '========================= getPostCategories ========================='
\r
77 for i in wp.getPostCategories(idNewPost):
\r
78 print '%d , %s , %d' % (i.id, i.name, i.isPrimary)
\r
80 print '========================= getTrackbackPings ========================='
\r
81 print wp.getTrackbackPings(idNewPost)
\r
83 #print '========================= deletePost ========================='
\r
84 print wp.deletePost(idNewPost)
\r
86 print '========================= getLastPost ========================='
\r
87 post = wp.getLastPost()
\r
88 print '%d %s %s' % (post.id, post.title, post.date)
\r