Upload file to Django in Requests.POST
Trying to upload a text file (of molecules) to ADMETlab 2.0 and download the corresponding CSV output, from within python.
Tried the following code to check whether the output is returned properly:
import requests
fyle = 'infile.sdf'
Headers = {"Referer" : "https://admetmesh.scbdd.com/service/screening/index", "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"}
with open(fyle, 'rb') as f:
r = requests.post('https://admetmesh.scbdd.com/service/screening/cal', files={fyle: f}, headers=Headers)
print(r.text)
Which led to this error:
ValueError: invalid literal for int() with base 16: b
I tried this fix and now, no error is raised but nothing except a blank new line is printed. Where am I going wrong?