简体   繁体   English

如何从rabbitmq消息中获取pika python中的basicproperties头字段?

[英]how to get basicproperties header field in pika python from rabbitmq messages?

def callback(ch, method, properties, body):
        prop = properties
        print prop
        #print prop[1]
        #print prop[“headers”]
        #print prop.headers()
        print body

This is the list from prop: 这是道具的清单:

<BasicProperties(['delivery_mode=2', "headers={'BIProto.ClickEvent': 'BIProto.ClickEvent'}", 'content_type=application/x-protobuf'])>

I'm able to print body and the list of basic properties. 我能够打印正文和基本属性列表。 But how can I just get headers? 但是我怎样才能得到标题?

All the #print statements in the function error-ed. 函数中的所有#print语句都出错了。

没关系,我所要做的就是打印prop.headers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM