Getting file type not allowed error while uploading the image with python code

this is my python code

import requests
import json

token_url = ‘http://mydomain/api/authorize/access_token
library = ‘http://mydomain/api/library

client_id = ‘*********’
client_secret = ‘************************’

data = {‘grant_type’:‘client_credentials’}

access_token_response = requests.post(token_url,data=data,verify=False,allow_redirects=False,auth=(client_id, client_secret))

tokens = json.loads(access_token_response.text)

print("Bearer " + tokens[‘access_token’])

headers = {‘Authorization’: "Bearer " + tokens[‘access_token’],‘Cache-Control’:‘no-cache’,‘content-type’: ‘multipart/form-data’}

payload = {‘Content-Disposition’: ‘form-data’,‘name’:‘files’,‘filename’:“image.jpg”,}

data = json.dumps(payload)
response = requests.request(‘POST’,library,data=data,headers=headers)
print(response.text)

i’m getting this error with xibo upload api

“files”:[{“name”:“1492523640-7615”,“size”:1316610,“type”:“multipart/form-data; boundary=--------------------------449316675376425057078541”,“error”:“Filetype not allowed”}]}

i’m using xibo 1.8.9 version …

Unfortunately we are not familiar with Python, but suspect that your multipart message is not formatted correctly. This could explain why “type” is showing the boundary code. I would recommend having another look at the code.

Many Thanks,

i have removed that boundary code … still its showing same error …

{“files”:[{“name”:“1532680322-5448”,“size”:156,“type”:“application/json”,“error”:“Filetype not allowed”}]}