Getting more detailed error messages for automated imports


I have a Python script that automates the import of a file to Anaplan:


fileData = {
"id" : "file_id_here",
"name" : 'file_name_here',
"chunkCount" : 1,
"delimiter" : '"',
"encoding" : "UTF-8",
"firstDataRow" : 2,
"format" : "txt",
"headerRow" : 1,
"separator" : ","

url = (f'{workspace_guid}/models/{model_guid}/' +

# Opens the data file (filData['name'] by default) and encodes it to utf-8
dataFile = open(fileData['name'], 'r').read().encode('utf-8')

fileUpload = requests.put(url, data=dataFile)
if fileUpload.ok:
print('File Upload Successful.')
print('There was an issue with your file upload: ' + str(fileUpload.status_code))

 I'm running some tests on files with errors in them. The problem I have is that the fileUpload.status_code only returns the message "There was an issue with your file upload: 401". It's not very informative or helpful. Whereas in Anaplan I might get more information about the error. Is there a way to query the Anaplan servers for this information?