How to commit a image via gitlab commit API?

Does commit API supports sending binary data? Is there any sample code?

data = {
        'branch': 'master',
        'commit_message': 'some message',
        'actions': [{
            'action': 'update',
            'file_path': 'pic1.jpeg',
            'content': imageData
        }]
    }

resp = requests.post(
        url='http://gitlab.wzx.com/api/v4/projects/1/repository/commits',
        data=data,
        headers={
            "PRIVATE-TOKEN": PRIVATE_TOKEN
        }
    )

imageData is type of bytes, when I send this request, I received the following response:

{
    message: "500 Internal Server Error"
}