[Fixed]-Django Storages Boto Bad Digest

1👍

See this relevant boto issue: https://github.com/boto/boto/issues/2868

Boto has some problems with string encodings in Python3. If you know the encoding, you Using response.content instead of response.text fixes the problem:

document_contents = ContentFile(response.content)
👤Zags

0👍

I had a similar problem.

I changed to boto3 and storage engine to to.

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

Finally I also had to convert the content to binary using .encode(‘utf-8’)

my_model.save("filename", document_contents.encode('uft-8'))

Leave a comment