Dear all, this is my first post here after 2 days of trying to get this to work without success.
I’m migrating into OpenEMR and got as far as cloning current patients with their respective ids into OpenEMR and checking what files exist in the old and new system.
That leaves 1 critical task:
- upload a file into a patient with a specific name
I’m writing this patient manager in python3
I looked into openemr/C_Document.class.php at master · openemr/openemr · GitHub
to see why it isn’t working but didn’t get any further than validating that ‘file’ is used to receive the file.
upload script (crude stuff here
print("will be uploaded")
uploadFiles = {'file': open(filePath, 'rb')}
url = baseUrl + '/controller.php?document&upload&patient_id=' + clientEmrId + '&parent_id=3&'
extraHeaders = {
'patient_id': clientEmrId,
'parent_id': '3',
'category_id': '3',
'process': 'true'
}
with requests.Session() as session:
login = session.post(loginUrl, data=payload)
r = session.post(url, files=uploadFiles, data=extraHeaders)
print(session.cookies.get_dict())
print(url,extraHeaders,uploadFiles)
Does anyone know what headers / cookies / body magic is required to make this work?