I have this code which deliberately attempts to upload a file that already exists in the Box folder.
try:
new_file = client.folder(8888888888888).upload('c.txt')
except:
print('End')
How do I capture the "409" response from Box that tells me that the file already exists? For simplicity, I would like something like:
try:
new_file = client.folder(8888888888888).upload('c.txt')
except 409:
print('File already exist in Box, file will be updated' )
updated_file = client.file(222222222222).update_contents('c.txt')
except 400:
print('Some other error occurred' )
How do I get the identify the error and also retrieve the file ID from the error?