Thursday, February 5, 2009

some lab 3 stuff

OK.

Lab 3 is not documented very well. I'll try to correct some things here:

in forming your json, on the appserver page, it has SINGLE QUOTES around the keys in the json. in using simplejson, this is not correct. simplejson will not interpret it correctly if they're not DOUBLE QUOTES.

here are a line on how to get things from s3:
sdb = boto.connect_sdb(KEY, SECRET KEY)
imageDomain = sdb.get_domain('picture')

items = sdb.query('picture', "['ratesort' < '" + nextratesort + "'] sort 'ratesort' desc", 11)
for key in items:
item = imageDomain.get_item(key)

what the query returns back seems to be a list of the keys into the domain. you can use these keys to get individual items out as i've done above.

Edit: I'm not sure exactly which ones of the values of the json need to have quotes around them, but i got a few errors because at least a few didn't have quotes, so I put quotes around all of mine to avoid the error.

No comments:

Post a Comment