How to use python requests to post image to gitlab

I’m fairly new to using the python requests library, and am currently trying to download an image off of JIRA and then upload that image to gitlab to later reference in a note, as documented here: The image is downloading properly from JIRA (I can see and open the file), however, I am getting an error 400 Bad Request response right now when I try and post it to gitlab.

My code looks like this:

gl_url = '' % gl_project_id

def image_post(image_url, file_name, jira_auth, gl_url, gl_token):
    image = requests.get(
    local_file = open(file_name, 'wb')
    image.raw.decode_content = True
    shutil.copyfileobj(image.raw, local_file)
    file = {'file': '@' + file_name}
    value =
        headers={'PRIVATE-TOKEN': gl_token, 'Content-Type': 'multipart/form-data'},
    return value

My gitlab token is working in other parts of the same program, so I don’t think that that is the problem. Any help would be greatly appreciated.