Skip to content

parse_security

faststream.rabbit.security.parse_security #

parse_security(security)

Convert security object to connection arguments.

Source code in faststream/rabbit/security.py
def parse_security(security: Optional[BaseSecurity]) -> "AnyDict":
    """Convert security object to connection arguments."""
    if security is None:
        return {}
    elif isinstance(security, SASLPlaintext):
        return _parse_sasl_plaintext(security)
    elif isinstance(security, BaseSecurity):
        return _parse_base_security(security)
    else:
        raise NotImplementedError(f"RabbitBroker does not support {type(security)}")