Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

Lot of errors at Django S3 example #51

@andresespinosapc

Description

@andresespinosapc

The first error I've got was at line 54: request_payload = json.loads(request.body), saying that the parameter must be 'str', not 'bytes'. I've fixed it writing this instead: request_payload = json.loads(request.body.decode()).

Then I've got one at line 113: policy = base64.b64encode(json.dumps(policy_document)). It said that a bytes-like object was required, not 'str'. So I changed that line to policy = base64.b64encode(json.dumps(policy_document).encode()), and it seemed to be fixed.

Now I'm getting an error at the next line, 114: signature = base64.b64encode(hmac.new(settings.AWS_CLIENT_SECRET_KEY, policy, hashlib.sha1).digest()). At some point of the hmac.new function I get this: key: expected bytes or bytearray, but got 'str'.

I'll try to fix it, but please tell me if I'm doing something wrong, maybe there's a better way of doing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions