Created
January 8, 2022 05:29
-
-
Save hamzakat/6dd9fd24b0cc531cbdcef1347e60a00c to your computer and use it in GitHub Desktop.
Revisions
-
hamzakat created this gist
Jan 8, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #! /usr/bin/env python3 import os import requests as req import json data_dir = "/data/feedback" feedbacks = [] for file in os.listdir(data_dir): file_path = os.path.join(data_dir, file) if os.path.isfile(file_path): with open(file_path) as file: file_list = file.read().splitlines() feedback_dict = {"title": file_list[0],"name": file_list[1],"date": file_lis$ feedbacks.append(feedback_dict) for f in feedbacks: print(f) print(type(f)) res = req.post("http://34.69.132.48/feedback", json=f) res.raise_for_status()