|
@ -268,7 +268,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
def wait_msg(self, event, timeout=None, raises=None): |
|
|
def wait_msg(self, event, timeout=None, raises=None): |
|
|
"""Wait for a message, similiar to :meth:`.wait_event` |
|
|
"""Wait for a message, similiar to :meth:`.wait_event` |
|
|
|
|
|
|
|
|
:param event: :class:`.EMsg` or job id |
|
|
:param event: event id |
|
|
:type event: :class:`.EMsg` or :class:`str` |
|
|
:type event: :class:`.EMsg` or :class:`str` |
|
|
:param timeout: seconds to wait before timeout |
|
|
:param timeout: seconds to wait before timeout |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
@ -276,7 +276,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: returns a message or :class:`None` |
|
|
:return: returns a message or :class:`None` |
|
|
:rtype: :class:`None`, or `proto message` |
|
|
:rtype: :class:`None`, or `proto message` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
resp = self.wait_event(event, timeout, raises) |
|
|
resp = self.wait_event(event, timeout, raises) |
|
|
|
|
|
|
|
@ -284,8 +284,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return resp[0] |
|
|
return resp[0] |
|
|
|
|
|
|
|
|
def send(self, message, body_params=None): |
|
|
def send(self, message, body_params=None): |
|
|
""" |
|
|
"""Send a message to CM |
|
|
Send a message to CM |
|
|
|
|
|
|
|
|
|
|
|
:param message: a message instance |
|
|
:param message: a message instance |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
@ -301,8 +300,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
CMClient.send(self, message) |
|
|
CMClient.send(self, message) |
|
|
|
|
|
|
|
|
def send_job(self, message, body_params=None): |
|
|
def send_job(self, message, body_params=None): |
|
|
""" |
|
|
"""Send a message as a job |
|
|
Send a message as a job |
|
|
|
|
|
|
|
|
|
|
|
.. note:: |
|
|
.. note:: |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
@ -338,8 +336,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return "job_%d" % jobid |
|
|
return "job_%d" % jobid |
|
|
|
|
|
|
|
|
def send_job_and_wait(self, message, body_params=None, timeout=None, raises=False): |
|
|
def send_job_and_wait(self, message, body_params=None, timeout=None, raises=False): |
|
|
""" |
|
|
"""Send a message as a job and wait for the response. |
|
|
Send a message as a job and wait for the response. |
|
|
|
|
|
|
|
|
|
|
|
.. note:: |
|
|
.. note:: |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
|
Not all messages are jobs, you'll have to find out which are which |
|
@ -350,11 +347,11 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
:type body_params: dict |
|
|
:type body_params: dict |
|
|
:param timeout: (optional) seconds to wait |
|
|
:param timeout: (optional) seconds to wait |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout`` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout` |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: response proto message |
|
|
:return: response proto message |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
job_id = self.send_job(message, body_params) |
|
|
job_id = self.send_job(message, body_params) |
|
|
response = self.wait_event(job_id, timeout, raises=raises) |
|
|
response = self.wait_event(job_id, timeout, raises=raises) |
|
@ -363,8 +360,7 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return response[0].body |
|
|
return response[0].body |
|
|
|
|
|
|
|
|
def send_message_and_wait(self, message, response_emsg, body_params=None, timeout=None, raises=False): |
|
|
def send_message_and_wait(self, message, response_emsg, body_params=None, timeout=None, raises=False): |
|
|
""" |
|
|
"""Send a message to CM and wait for a defined answer. |
|
|
Send a message to CM and wait for a defined answer. |
|
|
|
|
|
|
|
|
|
|
|
:param message: a message instance |
|
|
:param message: a message instance |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
|
:type message: :class:`.Msg`, :class:`.MsgProto` |
|
@ -374,11 +370,11 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
:type body_params: dict |
|
|
:type body_params: dict |
|
|
:param timeout: (optional) seconds to wait |
|
|
:param timeout: (optional) seconds to wait |
|
|
:type timeout: :class:`int` |
|
|
:type timeout: :class:`int` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise ``gevent.Timeout`` |
|
|
:param raises: (optional) On timeout if ``False`` return ``None``, else raise :class:`gevent.Timeout` |
|
|
:type raises: :class:`bool` |
|
|
:type raises: :class:`bool` |
|
|
:return: response proto message |
|
|
:return: response proto message |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:rtype: :class:`.Msg`, :class:`.MsgProto` |
|
|
:raises: ``gevent.Timeout`` |
|
|
:raises: :class:`gevent.Timeout` |
|
|
""" |
|
|
""" |
|
|
self.send(message, body_params) |
|
|
self.send(message, body_params) |
|
|
response = self.wait_event(response_emsg, timeout, raises=raises) |
|
|
response = self.wait_event(response_emsg, timeout, raises=raises) |
|
@ -394,14 +390,13 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
def get_sentry(self, username): |
|
|
def get_sentry(self, username): |
|
|
""" |
|
|
"""Returns contents of sentry file for the given username |
|
|
Returns contents of sentry file for the given username |
|
|
|
|
|
|
|
|
|
|
|
.. note:: |
|
|
.. note:: |
|
|
returns ``None`` if :attr:`credential_location` is not set, or file is not found/inaccessible |
|
|
returns ``None`` if :attr:`credential_location` is not set, or file is not found/inaccessible |
|
|
|
|
|
|
|
|
:param username: username |
|
|
:param username: username |
|
|
:type username: :class:`str` |
|
|
:type username: str |
|
|
:return: sentry file contents, or ``None`` |
|
|
:return: sentry file contents, or ``None`` |
|
|
:rtype: :class:`bytes`, :class:`None` |
|
|
:rtype: :class:`bytes`, :class:`None` |
|
|
""" |
|
|
""" |
|
@ -417,11 +412,10 @@ class SteamClient(CMClient, BuiltinBase): |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
def store_sentry(self, username, sentry_bytes): |
|
|
def store_sentry(self, username, sentry_bytes): |
|
|
""" |
|
|
"""Store sentry bytes under a username |
|
|
Store sentry bytes under a username |
|
|
|
|
|
|
|
|
|
|
|
:param username: username |
|
|
:param username: username |
|
|
:type username: :class:`str` |
|
|
:type username: str |
|
|
:return: Whenver the operation succeed |
|
|
:return: Whenver the operation succeed |
|
|
:rtype: :class:`bool` |
|
|
:rtype: :class:`bool` |
|
|
""" |
|
|
""" |
|
|