cur.execute("delete from user_images where owner_username=%s", ('testuserinit',)) cur.execute("delete from users where username=%s", ('testuserinit',)) con.commit() """ """ batch = [('users.create', ('robot', {'email':'*****@*****.**', 'password':'******'}, 'en', '', 1), 'user_creation', 'DATA_GENERATOR')] r = RPC.hit(batch) pprint(r) sys.exit() """ batch = [] count = 0 for file in os.listdir(IMG_PATH): if not file.lower().endswith('.jpg'): continue f = open(os.path.join(IMG_PATH, file), 'rb') data = Binary(f.read()) f.close() print "adding %s to upload batch" % file batch.append(('images.add', ('trey', file, data, 'ZAPI', '', ''), 'add_%s' % file, 'DATA_GENERATOR')) count += 1 if count % 20 == 0: r = RPC.hit(batch) pprint(r) batch = [] if len(batch): r = RPC.hit(batch) pprint(r)
print "Cleaning up..." cur.execute("delete from user_images where owner_username=%s", ('testuserinit',)) cur.execute("delete from users where username=%s", ('testuserinit',)) con.commit() """ """ batch = [('users.create', ('robot', {'email':'*****@*****.**', 'password':'******'}, 'en', '', 1), 'user_creation', 'DATA_GENERATOR')] r = RPC.hit(batch) pprint(r) sys.exit() """ batch = [] count = 0 for file in os.listdir(IMG_PATH): if not file.lower().endswith('.jpg'): continue f = open(os.path.join(IMG_PATH, file), 'rb') data = Binary(f.read()) f.close() print "adding %s to upload batch" % file batch.append(('images.add', ('trey', file, data, 'ZAPI', '', ''), 'add_%s' % file, 'DATA_GENERATOR')) count += 1 if count % 20 == 0: r = RPC.hit(batch) pprint(r) batch = [] if len(batch): r = RPC.hit(batch) pprint(r)