This is the script
image_file_path = "/home/ahsan_khan/Downloads/images.jpeg"
metadata_file_path = "/home/ahsan_khan/Downloads/body.xml"
api_url="
https://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/321889166/attachment/"
headers = {
"Content-Type": "application/xml;"
}
files = {
"attachment": ("attachment",open(image_file_path, "rb"),"image/jpeg"),
"metadata": ("metadata",open(metadata_file_path, "rb"),"application/xml" ,{"Content-Transfer-Encoding": "binary"})
}
oauth = OAuth1Session(
client_key=consumer_key,
client_secret=consumer_secret,
resource_owner_key=access_token,
resource_owner_secret=access_token_secret
)
resp =
oauth.post(api_url,files=files)
print (resp.text)