Coder Social home page Coder Social logo

mcafee-epo's People

Contributors

davidism avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mcafee-epo's Issues

error issue

Traceback (most recent call last):
  File "E:/py_workstation/common/programe/office_scan/McAfee/mcafee_py/mcafee_epo_1.py", line 7, in <module>
    systems = client('system.find', 'zhangsan')
  File "C:\Python27\lib\site-packages\mcafee_epo.py", line 120, in __call__
    return self._request(name, params=params, files=files)
  File "C:\Python27\lib\site-packages\mcafee_epo.py", line 69, in _request
    self._get_token(_skip=name == "core.getSecurityToken"),
  File "C:\Python27\lib\site-packages\mcafee_epo.py", line 49, in _get_token
    self._token = self._request("core.getSecurityToken")
  File "C:\Python27\lib\site-packages\mcafee_epo.py", line 77, in _request
    r = self._session.get(url, **kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.25.160', port=8443): Max retries exceeded with url: /remote/core.getSecurityToken?%3Aoutput=json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

No verification bypass option in session buildup

Great work! Please consider:

Change

import request.Session

to

import request
def __init__(self, url, username, password, verify=True, session=None):
        """Create a client for the given ePO server.

        :param url: Location of ePO server.
        :param username: Username to authenticate.
        :param password: Password to authenticate.
        :param session: Custom instance of :class:`requests.Session`,
            useful for configuring server verification.
        """
        self.url = url
        self.username = username
        self.password = password

        if session is None:
            session = requests.Session()

        self._session = session
        self._token = None

        self._verify = verify
        if not verify:
            requests.packages.urllib3.disable_warnings()

and

if any(kwargs.get(key) for key in ("data", "json", "files")):
            # Use post method if there is post data.
            r = self._session.post(url, verify=self._verify, **kwargs)
        else:
            r = self._session.get(url, verify=self._verify, **kwargs)

This allows the client to bypass certification verification in development situations

How do you upload a file?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.