cli_proton_python.utils module

Various client’s common utils functions

cli_proton_python.utils.dump_error(err_message)[source]

dump error message in parsable format

Parameters:err_message (str) – error massage to be logged
cli_proton_python.utils.dump_event(event)[source]

dumps proton event object

Parameters:event (proton.Event) – reactor event to be dumped
cli_proton_python.utils.hard_retype(value)[source]

tries to converts value to relevant type by re-typing

Parameters:value (str (unicode)) – value to be converted
Returns:re-typed value
Return type:int, float, bool, str
cli_proton_python.utils.nameval(in_string)[source]

converts given string to key, value and separator triplets

Parameters:in_string (str (unicode)) – key/value pair
Returns:key, value and separator triplet
Return type:tuple
cli_proton_python.utils.prepare_flat_map(entries, e_type=None)[source]

prepares map content from multiple key, value pairs

Note

only flat map is currently supported

Parameters:
  • entries (list) – list of key, separator, value triplets
  • e_type (str) – map entries desired content type (default: None)
Returns:

flat map containing given entries of given type

Return type:

dict

cli_proton_python.utils.print_message(msg, msg_format)[source]

prints a message in coresponding format

Parameters:
  • msg (proton.Message) – message
  • msg_format (str) – pre-defined message format
cli_proton_python.utils.retype_content(content, content_type)[source]

converts the content depending on type

Parameters:
  • content (str (unicode)) – message content
  • content_type (str) – message content type
Returns:

re-typed content according to given content_type

Return type:

int, float, long, bool, str

cli_proton_python.utils.set_up_client_logging(level)[source]

sets up the client library logging

Parameters:level (int, string) – log level number or proton logging type
cli_proton_python.utils.sleep4next(in_ts, in_count, in_duration, in_indx)[source]

custom sleep for checkpoints

Deprecated since version 1.0.0: use scheduler instead