Upload a PDF file with restapi

OK, I succeeded by adding to the previous Python script a request of the form:

requests.post('http://nohost/plone/folder', headers={ 'Accept': 'application/json', 'Content-Type': 'application/json', }, json=raw_data, auth=('admin', 'secret'))

Thanks to everybody!