# Python Kafka Basics

DevFeed: [Python Kafka Basics](<https://devfeed.tech/articles/python-kafka-basics-28234.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/python/2020/04/16/python-kafka-basics.html>)

Author: Fuzzygroup

Published: 2020-04-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Kafka](<https://devfeed.tech/topics/kafka.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [bootstrap](<https://devfeed.tech/tags/bootstrap.md>), [consumer](<https://devfeed.tech/tags/consumer.md>), [json](<https://devfeed.tech/tags/json.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [process](<https://devfeed.tech/tags/process.md>), [python](<https://devfeed.tech/tags/python.md>)

## AI overview

A brief introduction to using Kafka with Python. It explains that a Kafka consumer returns Consumer Records and shows how to access the message payload through the record's .value attribute, with a basic consumer example.

## Source excerpt

This is a starting point blog post where different things I learn about using Python Kafka will be documented. Getting the Value out of a Consumer Record The output of a Python Kafka call is a Consumer Record which is a "set of named tuples (blah blah blah)" where what you actually want is the value tuple. This can be gotten with the .value attribute: #!/usr/bin/env python from kafka import KafkaConsumer consumer = KafkaConsumer( 'dimon_tcpdump', group_id='zhg_group', value_deserializer=lambda m: json.loads(m.decode('utf-8')), bootstrap_servers='192.168.100.9:9092' ) for msg in consumer: # this is what you actually want; print msg.value # process msg here See Also Stack Overflow