Commit 02f1882c by arun.uday

commit6

parent 4f6b3a9a
...@@ -13,9 +13,14 @@ def extract_send_data(): ...@@ -13,9 +13,14 @@ def extract_send_data():
dict_data = extract_data(application_config.full_path_csv) dict_data = extract_data(application_config.full_path_csv)
list_removed = remove_list(dict_data) list_removed = remove_list(dict_data)
# dumps the list to json
json_data = json.dumps(list_removed) json_data = json.dumps(list_removed)
# create the paho client
client = Client() client = Client()
client.connect(application_config.mqtt_host, int(application_config.mqtt_port)) client.connect(application_config.mqtt_host, int(application_config.mqtt_port))
# publish the topic
client.publish(application_config.topic_name, json_data) client.publish(application_config.topic_name, json_data)
client.disconnect() client.disconnect()
except Exception as e: except Exception as e:
......
...@@ -5,6 +5,7 @@ from scripts.logging.loggers import logger ...@@ -5,6 +5,7 @@ from scripts.logging.loggers import logger
def extract_uploaded_data(full_path_csv, file_data): def extract_uploaded_data(full_path_csv, file_data):
try: try:
# reading the csv
with open(full_path_csv, file_mode) as file_object: with open(full_path_csv, file_mode) as file_object:
file_object.write(file_data.file.read()) file_object.write(file_data.file.read())
except Exception as e: except Exception as e:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment