started the status queue development #4
@ -19,6 +19,7 @@ def create_app():
|
|||||||
config.read(os.path.join(app.root_path, 'config.ini'))
|
config.read(os.path.join(app.root_path, 'config.ini'))
|
||||||
|
|
||||||
queuedir = os.path.join(app.root_path, 'queue')
|
queuedir = os.path.join(app.root_path, 'queue')
|
||||||
|
errordir = os.path.join(app.root_path,'error')
|
||||||
storagedir = os.path.join(app.root_path, 'storage')
|
storagedir = os.path.join(app.root_path, 'storage')
|
||||||
app.logger.setLevel(config['api'].get('log_level', 'ERROR'))
|
app.logger.setLevel(config['api'].get('log_level', 'ERROR'))
|
||||||
authenticator = Authenticator(config, app.logger)
|
authenticator = Authenticator(config, app.logger)
|
||||||
@ -120,7 +121,7 @@ def create_app():
|
|||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
|
|
||||||
@app.route('/status/queue', methods=['GET'])
|
@app.route('/status/queue', methods=['GET'])
|
||||||
def status_queueu():
|
def status_queue():
|
||||||
os_queue_list = os.listdir(queuedir)
|
os_queue_list = os.listdir(queuedir)
|
||||||
queue_list = []
|
queue_list = []
|
||||||
|
|
||||||
@ -138,6 +139,11 @@ def create_app():
|
|||||||
'created': data['data']['created'],
|
'created': data['data']['created'],
|
||||||
'uploaded': os.path.getctime(path)}
|
'uploaded': os.path.getctime(path)}
|
||||||
|
|
||||||
|
any_errors = os.listdir(errordir)
|
||||||
|
if item in any_errors:
|
||||||
|
with open(os.path.join(errordir, item), 'r') as e:
|
||||||
|
error_item = json.load(e)
|
||||||
|
mydata['error'] = error_item['error']
|
||||||
queue_list.append(mydata)
|
queue_list.append(mydata)
|
||||||
|
|
||||||
return Response(response=json.dumps(queue_list),
|
return Response(response=json.dumps(queue_list),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user