url = 'http://httpbin.org/post'
files = {'file': ('report.csv', """some,data,to,send
another,row,to,send
""")}
r = requests.post(url, files=files)
How to upload a text file using Python-Requests without writing to disk