Skip to content

Upload Error #43

@mirkoMurphy

Description

@mirkoMurphy

When using the upload or upload_image function,

TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

Solved in my case by changing generateRequest function when method is post or put to below;

if method == 'PUT' or method == 'POST':
    if (hasattr(data, 'encode')):
        result = urllib2.urlopen(request, data.encode("utf-8"))
    else:
        result = urllib2.urlopen(request, data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions