Twitter data streaming using APIs

Use Case 1:

Streaming real-time Twitter data using twitter API, Kafka, Python.


  1. Python
  2. Twitter Developer Account
  3. Kafka

Python Download and Installation:

Twitter Developer Account and Elevated access:

Kafka Download and Installation from below link:

Steps to run the code successfully –

  1. Stop previous running zookeeper(if zookeeper stops aburptly when you try to start) –
sudo service zookeeper stop
  1. Start the zookeeper –
bin/ config/
  1. Start the kafka server in new terminal –
bin/ config/
  1. Create topics –
bin/ --create --partitions 1 --replication-factor 1 --topic trump --bootstrap-server localhost:9092
  1. Run the python code in new terminal –
  1. Start kafka consumer in new terminal-
bin/ --bootstrap-server localhost:9092 --topic trump --from-beginning


View Github