How to use the pyrfc.LogonError function in pyrfc

To help you get started, we’ve selected a few pyrfc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / PyRFC / tests / test_errors.py View on Github external
def test_denied_users(self):
        denied_params = params.copy()
        denied_params["user"] = "BLAFASEL"
        try:
            pyrfc.Connection(**denied_params)
        except pyrfc.LogonError as ex:
            error = get_error(ex)

        assert error["code"] == 2
        assert error["key"] == "RFC_LOGON_FAILURE"
        assert error["message"][0] == "Name or password is incorrect (repeat logon)"
github SAP / PyRFC / examples / clientPrintDescription.py View on Github external
for key, width in zip(field_keys, field_widths):
                    sys.stdout.write(u"{0}".format(key).ljust(width).upper() + u" ")
                sys.stdout.write(u"\n")

                for field_description in type_desc.fields:
                    for key, width in zip(field_keys, field_widths):
                        sys.stdout.write(u"{0}".format(field_description[key]).ljust(width) + u" ")
                    sys.stdout.write(u"\n")
                sys.stdout.write(u" " * 4 + u"-----------( Structure of {0.name} )-----------\n".format(type_desc))
            sys.stdout.write(u"-" * sum(parameter_widths) + u"\n")
        connection.close()

    except CommunicationError:
        print ("Could not connect to server.")
        raise
    except LogonError:
        print ("Could not log in. Wrong credentials?")
        raise
    except (ABAPApplicationError, ABAPRuntimeError):
        print ("An error occurred.")
        raise