waiting for item to be created before modifying metadata

to avoid `item.modify_metadata()` raise error (like `Unable to locate identifier`)
pull/459/head
yzqzss 1 year ago
parent f22787d2ac
commit a5e9135d26

@ -248,6 +248,14 @@ def upload(wikis, config={}, uploadeddumps=[]):
#Upload files and update metadata
try:
item.upload(dumpdir + '/' + dump, metadata=md, access_key=accesskey, secret_key=secretkey, verbose=True, queue_derive=False)
retry = 20
while not item.exists and retry > 0:
retry -= 1
print "Waitting for item \"%s\" to be created... (%s)" % (identifier, retry)
time.sleep(10)
item = get_item(identifier)
item.modify_metadata(md) # update
print 'You can find it in https://archive.org/details/%s' % (identifier)
uploadeddumps.append(dump)

Loading…
Cancel
Save