utf8' codec can't decode byte 0x89 in position 15: invalid start byte

前端 未结 1 1757
礼貌的吻别
礼貌的吻别 2021-01-24 00:32

This is a view for my project in which I am trying to upload images from my local system to s3 using boto.

class ImageList(generics.ListCreateAPIView):
                 


        
相关标签:
1条回答
  • 2021-01-24 00:55

    JSON strings are unicode strings, not binary strings. Your image contains binary data, and the JSON serializer is complaining about that.

    One common approach to work around this problem is to use base64 or base85. Python has builtin support for those two (and other) encodings via the base64 module.

    0 讨论(0)
提交回复
热议问题