#!/usr/bin/python
#

import sys, os
import xmlrpclib

title = "Testing XML-RPC serializing bug"

array2 = [{"var1" : "sd", "title" : "Why"},
		{"var1" : "ds", "title" : "thiS"}]
array1 = {"array" : "Not Working?",
		"songs" : array2}

post = {'title' : title,
		'wp_slug' : title,
		'categories' : ["Uncategorized"],
		'custom_fields' : [{'key' : 'no_serializing', 'value' : title},
							{'key' : 'test', 'value' : array1},
							{'key' : 'links', 'value' : ['http://core.trac.wordpress.org/ticket/10656', 'http://core.trac.wordpress.org/attachment/ticket/10656/wordpress_xmlrpc_custom_serialized.patch']}]}

username = ''
password = ''
wordpress = xmlrpclib.ServerProxy('http://loaclhost/wordpress/xmlrpc.php')
postid = int(wordpress.metaWeblog.newPost(1, username, password, post, 1))
print "Post #%s added" % (postid)
