robocorp / rpaframework

Collection of open-source libraries and tools for Robotic Process Automation (RPA), designed to be used with both Robot Framework and Python
https://www.rpaframework.org/
Apache License 2.0
1.17k stars 227 forks source link

RPA.Notifier Notify Telegram returning True when failing to send message #969

Closed celsocontim closed 1 year ago

celsocontim commented 1 year ago

When the telegram notification is blocked due to network restrictions, it throws the error:

Notify errors: ["HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot6*****90:AAF*********yU/sendMessage (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))"]

However, the return value of the keyword is still True, as can be seen in the screenshot attached.

RPAFramework 23.1.0 Python 3.10.7 OS Windows 10 Pro

cmin764 commented 1 year ago

Well, this works exactly as expected, as you don't call Notify Telegram directly, you wrap it instead with the Run Keyword And Return Status which will never fail (thus status is always True), because Notify Telegram doesn't raise in this case and returns a status instead, according to the response handler logic:

    def _handle_response(self, response) -> bool:
        if response.status == "Success":
            self.logger.info("Notify %s resulted in Success", response.provider)
            return True
        else:
            self.logger.error("Notify errors: %s", response.errors)
            return False

To fix it, you have two options:


I'll be closing this now as it doesn't look like an issue/bug with our library.