From 916cf0db7fb66ede18241bb54a3e3e77d4d02ecc Mon Sep 17 00:00:00 2001 From: "felix.gao" Date: Tue, 24 Oct 2023 12:16:59 +0800 Subject: [PATCH] Replace dependency amqplib with amqp --- graypy/rabbitmq.py | 3 ++- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/graypy/rabbitmq.py b/graypy/rabbitmq.py index ea7be2cdf..2d03b24cf 100644 --- a/graypy/rabbitmq.py +++ b/graypy/rabbitmq.py @@ -8,7 +8,7 @@ from logging import Filter from logging.handlers import SocketHandler -from amqplib import client_0_8 as amqp # pylint: disable=import-error +import amqp from graypy.handler import BaseGELFHandler @@ -98,6 +98,7 @@ def __init__(self, cn_args, timeout, exchange, exchange_type, routing_key): self.exchange_type = exchange_type self.routing_key = routing_key self.connection = amqp.Connection(connection_timeout=timeout, **self.cn_args) + self.connection.connect() self.channel = self.connection.channel() self.channel.exchange_declare( exchange=self.exchange, diff --git a/setup.py b/setup.py index 925dc12b7..38ba42bcb 100755 --- a/setup.py +++ b/setup.py @@ -80,10 +80,10 @@ def run_tests(self): "pylint>=1.9.3,<2.0.0", "mock>=2.0.0,<3.0.0", "requests>=2.20.1,<3.0.0", - "amqplib>=1.0.2,<2.0.0", + "amqp>=5.1.1", ], extras_require={ - "amqp": ["amqplib==1.0.2"], + "amqp": ["amqp==5.1.1"], "docs": [ "sphinx>=2.1.2,<3.0.0", "sphinx_rtd_theme>=0.4.3,<1.0.0",