added something
This commit is contained in:
parent
cde39a5f77
commit
9dd8a81913
@ -1,7 +1,9 @@
|
|||||||
|
import logging
|
||||||
from flask import Flask, request, abort, Response
|
from flask import Flask, request, abort, Response
|
||||||
import json
|
import json
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/', methods=['POST'])
|
@app.route('/', methods=['POST'])
|
||||||
@ -26,6 +28,8 @@ def record():
|
|||||||
with open("arrived.txt", "at") as f:
|
with open("arrived.txt", "at") as f:
|
||||||
f.write(f"{desc['device_id']}\n")
|
f.write(f"{desc['device_id']}\n")
|
||||||
|
|
||||||
|
app.logger.info(f"Arrived: {desc['device_id']}")
|
||||||
|
|
||||||
return Response(status=200)
|
return Response(status=200)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -7,6 +9,9 @@ from datetime import datetime
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
sleep_time = int(sys.argv[1])
|
||||||
|
|
||||||
for root, _, files in os.walk("big_chop_output/"):
|
for root, _, files in os.walk("big_chop_output/"):
|
||||||
for file in files:
|
for file in files:
|
||||||
full_filename = os.path.join(root,file)
|
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 = requests.post("http://127.0.0.1:8000/filter", files=files)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
if sleep_time > 0:
|
||||||
|
time.sleep(sleep_time)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user