Skip to content

Commit

Permalink
tolerate 504s
Browse files Browse the repository at this point in the history
  • Loading branch information
fthiery committed Jan 17, 2025
1 parent eef9a6a commit a1d032c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions examples/transfer_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,22 @@ def print_progress(progress):

if args.apply:
print('Starting upload')
resp = msc_dest.add_media(**upload_args)
oid_dest = resp['oid']
try:
resp = msc_dest.add_media(**upload_args)
oid_dest = resp['oid']

if args.sync_perms:
sync_group_permissions(msc_src, oid_src, msc_dest, oid_dest)
if args.sync_perms:
sync_group_permissions(msc_src, oid_src, msc_dest, oid_dest)

if resp['success']:
print(f'File {zip_path} upload finished, object id is {oid_dest}')
else:
print(f'Upload of {zip_path} failed: {resp}')
if resp['success']:
print(f'File {zip_path} upload finished, object id is {oid_dest}')
else:
print(f'Upload of {zip_path} failed: {resp}')
except Exception as e:
if "504" in str(e):
print(f"Timeout error, perms are probably wrong: {e}")
else:
raise e
else:
print(f'[Dry run] Would upload {zip_path} with {upload_args}')

Expand Down

0 comments on commit a1d032c

Please sign in to comment.