added something

This commit is contained in:
Pünkösd Marcell 2021-11-24 21:25:55 +01:00
parent cde39a5f77
commit 9dd8a81913
2 changed files with 11 additions and 0 deletions

View File

@ -1,7 +1,9 @@
import logging
from flask import Flask, request, abort, Response
import json
app = Flask(__name__)
app.logger.setLevel(logging.DEBUG)
@app.route('/', methods=['POST'])
@ -26,6 +28,8 @@ def record():
with open("arrived.txt", "at") as f:
f.write(f"{desc['device_id']}\n")
app.logger.info(f"Arrived: {desc['device_id']}")
return Response(status=200)

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python3
import sys
import time
import requests
import os
import os.path
@ -7,6 +9,9 @@ from datetime import datetime
def main():
sleep_time = int(sys.argv[1])
for root, _, files in os.walk("big_chop_output/"):
for file in files:
full_filename = os.path.join(root,file)
@ -24,6 +29,8 @@ def main():
r = requests.post("http://127.0.0.1:8000/filter", files=files)
r.raise_for_status()
if sleep_time > 0:
time.sleep(sleep_time)
if __name__ == '__main__':