<commit_before>import json
import logging
import ssl

from aio_pika import connect_robust
from aio_pika.abc import SSLOptions
from aio_pika.connection import URL

_log = logging.getLogger(__name__)


CLOSING = object()


class Consumer:
    def __init__(self, config, handler):
        self._url = URL(config["amqp_url"])
        self._destination = config["queue"]
        self._handler = handler
        self._url = self._url.update_query(
            {"connection_name": f"FMN sender on {self._destination}"}
        )
        if "tls" in config:
            self._url = self._url.update_query(
                SSLOptions(
                    cafile=config["tls"]["ca_cert"],
                    certfile=config["tls"]["certfile"],
                    keyfile=config["tls"]["keyfile"],
                    no_verify_ssl=ssl.CERT_REQUIRED,
                )
            )
        self._connection = None
        self._channel = None
        self._queue = None
        self._queue_iter = None<commit_msg>Specify the auth mode in the sender<commit_after>import json
import logging
import ssl

from aio_pika import connect_robust
from aio_pika.abc import SSLOptions
from aio_pika.connection import URL

_log = logging.getLogger(__name__)


CLOSING = object()


class Consumer:
    def __init__(self, config, handler):
        self._url = URL(config["amqp_url"])
        self._destination = config["queue"]
        self._handler = handler
        self._url = self._url.update_query(connection_name=f"FMN sender on {self._destination}")
        if "tls" in config:
            self._url = self._url.update_query(auth="EXTERNAL")
            self._url = self._url.update_query(
                SSLOptions(
                    cafile=config["tls"]["ca_cert"],
                    certfile=config["tls"]["certfile"],
                    keyfile=config["tls"]["keyfile"],
                    no_verify_ssl=ssl.CERT_REQUIRED,
                )
            )
        self._connection = None
        self._channel = None
        self._queue = None
        self._queue_iter = None
{'fraction_non_alphanumeric': 0.10101498308361527, 'fraction_numerical': 0.0, 'mean_word_length': 2.1363636363636362, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5683131', 'n_tokens_mistral': 590, 'n_tokens_neox': 589, 'n_words': 125}