| 1 | #!/usr/bin/python |
|---|
| 2 | # |
|---|
| 3 | |
|---|
| 4 | import sys, os |
|---|
| 5 | import xmlrpclib |
|---|
| 6 | |
|---|
| 7 | title = "Testing XML-RPC serializing bug" |
|---|
| 8 | |
|---|
| 9 | array2 = [{"var1" : "sd", "title" : "Why"}, |
|---|
| 10 | {"var1" : "ds", "title" : "thiS"}] |
|---|
| 11 | array1 = {"array" : "Not Working?", |
|---|
| 12 | "songs" : array2} |
|---|
| 13 | |
|---|
| 14 | post = {'title' : title, |
|---|
| 15 | 'wp_slug' : title, |
|---|
| 16 | 'categories' : ["Uncategorized"], |
|---|
| 17 | 'custom_fields' : [{'key' : 'no_serializing', 'value' : title}, |
|---|
| 18 | {'key' : 'test', 'value' : array1}, |
|---|
| 19 | {'key' : 'links', 'value' : ['http://core.trac.wordpress.org/ticket/10656', 'http://core.trac.wordpress.org/attachment/ticket/10656/wordpress_xmlrpc_custom_serialized.patch']}]} |
|---|
| 20 | |
|---|
| 21 | username = '' |
|---|
| 22 | password = '' |
|---|
| 23 | wordpress = xmlrpclib.ServerProxy('http://loaclhost/wordpress/xmlrpc.php') |
|---|
| 24 | postid = int(wordpress.metaWeblog.newPost(1, username, password, post, 1)) |
|---|
| 25 | print "Post #%s added" % (postid) |
|---|