diff --git a/api.py b/api.py index 4177733b100e1ad9f4f8abe23a052a1646d209cb..021113207e2c2ebaf8a57fdb7014704de91c66d2 100755 --- a/api.py +++ b/api.py @@ -311,7 +311,7 @@ class WebData(Resource): if ('request_source' in in_data and in_data['request_source'] == 'divided'): request_source = 'divided' - if ('reg_auth' in in_data): + if ('reg_auth' in in_data and in_data['reg_auth'] in regAuthDict): reg_auth = in_data['reg_auth'] if ('status' in in_data and in_data['status'].upper() in ['OK','DISABLED','ERROR','UNKNOWN']): @@ -320,6 +320,36 @@ class WebData(Resource): if ('idp' in in_data): idp = in_data['idp'] + # here I have to parse eccs-log file + # target result is array like: + # "YYYY-MM-DD" => [ + # "request_count" => [ + # web => 100, + # api => 200 + # ], + # "uniqIP" => [ + # web => 100, + # api => 200 + # ], + # "requested_param" => [ + # idp => 100, + # reg_auth => 200 + # ], + # idp => [ + # "xx" => [ + # "api" => 1, + # "web" => 10 + # ], + # ], + # reg_auth => [ + # "xx" => [ + # "api" => 1, + # "web" => 10 + # ], + # ], + # ] + + lines = [] results = [] cur_date = date_from @@ -332,12 +362,9 @@ class WebData(Resource): lines = fo.readlines() except FileNotFoundError as e: - if (eccsDataTable): - return '' - else: - return jsonify(error=f'FileNotFound: ECCS script has not been executed on {date} yet') - + results[cur_date] = [] + cur_date += timedelta(days=1)