As @garnatt already said, the set_contents_from_filename
method will automatically calculate the MD5 checksum for you.
If you look at the docs, there is a method called compute_md5
which returns a tuple containing the MD5 checksum in a hexdigest (what your getting in the console using md5sum
) and also base64 encoded which it sends to Amazon which is what your seeing in the headers.
The md5
parameter in the set_contents_from_filename
method takes the MD5 checksum in a tuple format, the same way compute_md5
returns. If you need to calculate it manually, the best way is to use the compute_md5
method. Otherwise you have to build a tuple in the correct format before passing it to the md5
parameter.