Disable printing error message from Python API

I was requesting time series tick data using Python API. Whenever there is no data in the provided time range, the API itself prints out the error message "Error with MFRISCOA1.MX: No data available for the requested date range". How can I disable the API printing such error messages?

Best Answer

  • The error message comes from the logging that Eikon Data APIs for Python library implements. You can suppress the logging of errors by setting the log level to a value that ensures errors and warnings are ignored:

    import logging
    eikonLogger = logging.getLogger('pyeikon')
    eikonLogger.setLevel(logging.FATAL)