cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to connect to epo server 5.0, through python script?

import mcafee

mc = mcafee.client('epo-windows','8443','admin','Infyepo@123')

print ("hello");

When I try to connect to epo server 5.0 , which is located on remote machine by using above python script I am getting following excepion.

Please suggest the solution.

Traceback (most recent call last):

  File "C:\Python33\lib\urllib\request.py", line 1248, in do_open

    h.request(req.get_method(), req.selector, req.data, headers)

  File "C:\Python33\lib\http\client.py", line 1061, in request

    self._send_request(method, url, body, headers)

  File "C:\Python33\lib\http\client.py", line 1099, in _send_request

    self.endheaders(body)

  File "C:\Python33\lib\http\client.py", line 1057, in endheaders

    self._send_output(message_body)

  File "C:\Python33\lib\http\client.py", line 902, in _send_output

    self.send(msg)

  File "C:\Python33\lib\http\client.py", line 840, in send

    self.connect()

  File "C:\Python33\lib\http\client.py", line 1194, in connect

    self.timeout, self.source_address)

  File "C:\Python33\lib\socket.py", line 417, in create_connection

    for res in getaddrinfo(host, port, 0, SOCK_STREAM):

socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "C:\Python33\lib\mcafee.py", line 305, in get_response

    sock = self.create_socket(url, fileargs)

  File "C:\Python33\lib\mcafee.py", line 375, in create_socket

    return self.opener.open(url)

  File "C:\Python33\lib\urllib\request.py", line 469, in open

    response = self._open(req, data)

  File "C:\Python33\lib\urllib\request.py", line 487, in _open

    '_open', req)

  File "C:\Python33\lib\urllib\request.py", line 447, in _call_chain

    result = func(*args)

  File "C:\Python33\lib\urllib\request.py", line 1283, in https_open

    context=self._context, check_hostname=self._check_hostname)

  File "C:\Python33\lib\urllib\request.py", line 1251, in do_open

    raise URLError(err)

urllib.error.URLError: <urlopen error [Errno 11004] getaddrinfo failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "D:\PythonWorkspace\de.vogella.python.first\src\webapiscriptexample-1.py", line 4, in <module>

    mc = mcafee.client('epo-windows','8443','admin','Infyepo@123')

  File "C:\Python33\lib\mcafee.py", line 537, in __init__

    self._invoker.save_token()

  File "C:\Python33\lib\mcafee.py", line 243, in save_token

    response = self.get_response(url)

  File "C:\Python33\lib\mcafee.py", line 313, in get_response

    log_and_raise_error(logging.ERROR, 'Failed to reach the server %s:%s. Error/reason: %s' % (self.host,self.port,str(e)))

  File "C:\Python33\lib\mcafee.py", line 92, in log_and_raise_error

    raise CommandInvokerError(code, msg)

mcafee.CommandInvokerError: Failed to reach the server epo-windows:8443. Error/reason: <urlopen error [Errno 11004] getaddrinfo failed>

2 Replies
jbrooks2
Level 9
Report Inappropriate Content
Message 2 of 3

Re: How to connect to epo server 5.0, through python script?

The version of Python you are using appears to be Python 3.3.  The mcafee.py script is not 3.x compatible.  It's only compatible with 2.x and has been tested against 2.7.  I would suggest running against 2.7 and try again.

Message was edited by: jbrooks2 on 10/22/13 11:52:35 AM CDT
tnichola
Level 7
Report Inappropriate Content
Message 3 of 3

Re: How to connect to epo server 5.0, through python script?

dipaliepo, 

I took the python client from MFS 5.0.0 and ran the script you have above (but pointed to oriondemo) and it worked as I expected.  No errors and displayed, "hello".

Can you use the python client shipped with MFS or do you need Python 3.3 for a reason?

Message was edited by: tnichola on 10/22/13 11:58:11 AM CDT
You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community