-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
23 lines (17 loc) · 628 Bytes
/
Copy pathrun.py
File metadata and controls
23 lines (17 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
import glob, requests
server_ip = "0.0.0.0" # Replace with the server IP
all_feedback = []
for file in glob.glob("/data/feedback/*.txt"):
with open(file) as file:
lines = file.readlines()
data = {"title": lines[0].strip(),
"name": lines[1].strip(),
"date": lines[2].strip(),
"feedback": lines[3].strip()}
all_feedback.append(data)
for feedback in all_feedback:
response = requests.post(f"http://{server_ip}/feedback/", json=feedback)
print(response.status_code)
if not response.ok:
print(response.text)