import httplib2 import simplejson import urlparse import random h = httplib2.Http(".cache") #BASE = "http://bitworking.org/projects/robaccia/main.cgi/blog/index.json" BASE = "http://localhost:8080/blog/index.json" (resp, content) = h.request(BASE) struct = simplejson.loads(content) print content print if 1: for member in struct['members']: abs_member = urlparse.urljoin(BASE, member['href']) (resp, content) = h.request(abs_member) print content struct = simplejson.loads(content) struct['title'] += " UPDATED" (resp, content) = h.request(abs_member, method="PUT", body=simplejson.dumps(struct)) print print resp, content id = str(random.randint(0,10000)) new_member = { "title": "Created from the client" + id, "content": "not much to see" } (resp, content) = h.request(BASE, method="POST", body=simplejson.dumps(new_member)) print resp, content