davidism / mcafee-epo

Python client for McAfee ePolicy Orchestrator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you upload a file?

gdementen opened this issue · comments

I can't seem to import a task from a local xml file.

inst_ma_eval.xml is a task exported from the epo website

>>> c = Client(...)
>>> with open('inst_ma_eval.xml', 'r') as f:
...     c('clienttask.importClientTask', files={'uploadFile': f})
APIError: Error 0 :
java.lang.reflect.InvocationTargetException

Do you have any clue as to what I am doing wrong? I have tried passing the file content as a string instead, or opening the file as bytes ('rb' instead of 'r') but I always get that damn java.lang.reflect.InvocationTargetException error. Any idea would be very much appreciated.

Sorry, I haven't actually worked with ePO in 6 years or so. Sounds like it's an issue with the data sent to ePO, not with this library. You'll need to determine what that error message means on the ePO side, maybe it indicates you need to send other data, or use a different command or parameter name? This library knows nothing about what a given command takes, it only knows how to format any given parameters into a request. You can pass file data in any format recognized by the Requests library, so any of the forms you tried are valid in that regard.

I suspected the library is not at fault (I have looked at your code and even pretty printed the request sent to the server) but I was just hoping you did use that functionality and had some tips to share. Thanks for your work and having taken the time to answer anyway!