Skip to content

Commit

Permalink
Fixed logs metric parser
Browse files Browse the repository at this point in the history
  • Loading branch information
catttam committed Oct 16, 2024
1 parent e9b0f3c commit 9be9e3b
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions logs_metric_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@

args = parser.parse_args()

wr="w"
if args.use_existing:
wr="a"

if args.create:
parse_create_info(wr)
else:
with open(args.file_path, 'r') as rawfile:
metrics = json.loads(rawfile.read())
try:
START_DATE = metrics["general"]["start_date"]
END_DATE = metrics["general"]["end_date"]
except:
START_DATE = metrics["general"]["date_time"]
END_DATE = metrics["general"]["date_time"]

"""
> Countries reached
> Output format: {continent, country, total_visits, unique_visits, start_date, end_date}
Expand Down Expand Up @@ -103,22 +119,6 @@ def parse_create_info(write_type):
cfile.close()
rawfile.close()

wr="w"
if args.use_existing:
wr="a"

if args.create:
parse_create_info(wr)
else:
with open(args.file_path, 'r') as rawfile:
metrics = json.loads(rawfile.read())
try:
START_DATE = metrics["general"]["start_date"]
END_DATE = metrics["general"]["end_date"]
except:
START_DATE = metrics["general"]["date_time"]
END_DATE = metrics["general"]["date_time"]

if args.general:
parse_geolocation_info(wr)
if args.partial:
Expand Down

0 comments on commit 9be9e3b

Please sign in to comment.