Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell boto operation was successful?

I'm doing fairy straightforward uploading with boto

for path, dirs, files in os.walk("data"):
    for file in files:
        k = Key(bucket)
        k.key = file
        k.set_contents_from_filename(os.path.join(path,file))

but set_contents_from_filename does not return anything. How do I tell the operation was success and not failed silently? I'm using RiakCS as a backend if it is important.

like image 545
Moonwalker Avatar asked Oct 23 '25 02:10

Moonwalker


1 Answers

Since all of the underlying service requests that boto makes are HTTP-based, boto monitors the status codes and raises a Python exception if the HTTP status code does not indicate success. So, if it doesn't raise an exception it should be successful.

like image 102
garnaat Avatar answered Oct 25 '25 15:10

garnaat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!