title: Problem sending data with kafka producer in Python (Jupyter Notebook)
body: <p>i'm trying to create a Big Data analysis using Kafka, Python and Twitter. I have a data stream of tweets that i only take the hashtag of them. My problem goes with the producer Kafka have for use in Python. I can't send the data i want into the topic i created because i don't see any option to send the content of a variable with the producer.</p>
  
  <p>In <a href="https://kafka-python.readthedocs.io/en/master/usage.html" rel="nofollow noreferrer">https://kafka-python.readthedocs.io/en/master/usage.html</a> i can only see the option to send a exact string with <code>b'some_string'</code>. But i want to send the hashtag i take from the Twitter Stream. I don't know much about Python so excuse me if the solution is obvious.</p>
  
  <p>Imports:</p>
  
  <pre><code>from pyspark import SparkContext
  from pyspark.streaming import StreamingContext
  from pyspark.streaming.kafka import KafkaUtils
  import json
  import tweepy
  from tweepy import OAuthHandler
  from tweepy import Stream
  import kafka
  from kafka import SimpleProducer, KafkaClient
  from kafka import KafkaProducer
  </code></pre>
  
  <p>Streaming Context:</p>
  
  <pre><code>ssc = StreamingContext(sc,60)
  </code></pre>
  
  <p>Keys:</p>
  
  <pre><code>consumer_key="consumer_key"
  consumer_secret="consumer_secret"
  access_token="access_token"
  access_token_secret="access_token_secret"
  </code></pre>
  
  <p>Tweepy:</p>
  
  <pre><code>auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
  auth.set_access_token(access_token, access_token_secret)
  api = tweepy.API(auth)
  </code></pre>
  
  <p>Producer:</p>
  
  <pre><code>producer = KafkaProducer(bootstrap_servers=['localhost:9092'])
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>class MyStreamListener(tweepy.StreamListener):
  
      def on_status(self, status):
          for hashtag in status.entities['hashtags']:
              prueba = b'hashtag["text"]'
              producer.send('topic', prueba)
              return True
      def on_error(self, status_code):
          if status_code == 420:
              #returning False in on_data disconnects the stream
              return False
  </code></pre>
  
  <p>StreamListener:</p>
  
  <pre><code>myStreamListener = MyStreamListener()
  myStream = tweepy.Stream(auth = api.auth, listener=MyStreamListener())
  </code></pre>
  
  <p>Tweet Stream:</p>
  
  <pre><code>myStream.filter(track=['some_text'])
  </code></pre>
  
  <p>The thing is, the producer only send the literal string of <code>prueba</code> that is <code>"(hashtag["text"])"</code>. I want to send not the exact thing but the content of it.</p>
  
  <p>Thanks in advance.</p>