Last active
January 22, 2023 13:21
-
-
Save merlin-quix/5d8e30ac034402bbee41b4b0a5531584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing packages | |
import pandas as pd | |
import time, json | |
import datetime as dt | |
import requests | |
from kafka import KafkaProducer | |
df = pd.read_csv("spam.csv") | |
# initializing Kafka Producer Client | |
producer = KafkaProducer(bootstrap_servers=['localhost:9092'], | |
value_serializer=lambda x: | |
json.dumps(x,default=str).encode('utf-8')) | |
print(f'Initialized Kafka producer at {dt.datetime.utcnow()}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment