首页 > 编程语言 > 详细

Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复

时间:2019-04-15 23:02:14      阅读:442      评论:0      收藏:0      [点我收藏+]

网上很多写法都是 type=‘fanout‘ 这样的。(这里是基于python=3.6版本, pika=0.13.0 版本)

credentials = pika.PlainCredentials('guest', 'guest')
connection = pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1',5672,'/',credentials))
channel = connection.channel()
# 定义交换机,exchange表示交换机名称,type表示类型
channel.exchange_declare(exchange='logs_fanout', type='fanout')

抛出异常

channel.exchange_declare(exchange='logs_fanout', type='fanout')
TypeError: exchange_declare() got an unexpected keyword argument 'type'

应该把:type=‘fanout‘ 改成 change_type=‘fanout‘

channel.exchange_declare(exchange='logs_fanout', exchange_type='fanout')

Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复

原文:https://www.cnblogs.com/yxhblogs/p/10713282.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!