filepath = 'yourfilename.txt'
with open(filepath) as fh:
    mydata = fh.read()
response = requests.put('https://api.elasticemail.com/attachments/upload',
    data=mydata, auth=('omer', 'b01ad0ce'), headers={'content-type':
    'text/plain'}, params={'file': filepath})
Как указать python запросы http put body?