import sys, time
from xmlrpclib import *

client = Server("http://localhost:6690/")
id = client.chunked.startInsert(sys.argv[1], 3)
file = open(sys.argv[2], "r")
while 1:
    status=client.chunked.getStatus(id)
    print "status:", status
    chunk=file.read(2048)
    if not chunk:
        break
    client.chunked.putChunk(id, Binary(chunk))
    status=client.chunked.getStatus(id)
    print "status:", status
print 'Done'
while 1:
    status=client.chunked.getStatus(id)
    print "status", status
    time.sleep(5)
