id = collection.id title = collection.title print id if id != None: collection_id = omeka_client.get_collection_id_by_dc_identifier(id, name=title, create=args['create_collections'], public=args["public"]) print "Collection ID", collection_id uploaded_item_ids = [] for item in csv_data.items: print item.type id = item.id if id != None: title = item.title type = item.type previous_id = omeka_client.get_item_id_by_dc_identifier(id) omekaize(item) jsonstr = json.dumps(item.omeka_data) # Upload it if previous_id != None: logger.info("Re-uploading %s", previous_id) response, content = omeka_client.put("items" , previous_id, jsonstr) new_item = json.loads(content) if 'id' not in new_item: print new_item else: logger.info("Uploading new version") response, content = omeka_client.post("items", jsonstr) #Looks like the ID wasn't actually there, so get it to mint a new one