简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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