Catching ERROR while using ek.set_app_key() function in Python

Hello everyone, I'd like to catch the error displayed by the function ek.set_app_key() when I pass a wrong key.

Can you please help me to do so using Python. I want to raise an error when the app key is wrong. I tried Try and Except but it seems that the message diplayed by ek.set_app_key() is not recognized as an error by python.


Thank you for your help.

Best Answer

  • umer.nalla
    umer.nalla LSEG
    Answer ✓

    Hi @Oussama

    I just heard back from another Eikon API developer who advised the following solution:

    ek = rd.eikon
    ek.set_app_key("junk")
    if rd.session.get_default().open_state == rd.OpenState.Opened:
    print("Opened")
    else:
    print("Failed")

    1658149439360.png

    Apologies for the misinformation earlier.

Answers