From 5d54c6a624c209c96a84d0a5c0627b1763d63fc2 Mon Sep 17 00:00:00 2001 From: Joshua <138818689+francojoshua@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:50:04 -0400 Subject: [PATCH 1/2] Add __get_404_response_count() --- read_log.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/read_log.py b/read_log.py index 4ea23e7..ed90638 100644 --- a/read_log.py +++ b/read_log.py @@ -43,3 +43,10 @@ print("No match found.") df = pd.DataFrame(data) + + +def __get_404_response_count(df): + """ + Provide the total amount of requests that have a '404' not found status code. + """ + return len(df[df["status_code"] == "404"]) From eddfaec7467d6fee0857dfaaf5eed351b8870118 Mon Sep 17 00:00:00 2001 From: Joshua <138818689+francojoshua@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:54:02 -0400 Subject: [PATCH 2/2] Move function up --- read_log.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/read_log.py b/read_log.py index ed90638..5ff9a87 100644 --- a/read_log.py +++ b/read_log.py @@ -3,6 +3,14 @@ import pandas as pd + +def __get_404_response_count(df): + """ + Provide the total amount of requests that have a '404' not found status code. + """ + return len(df[df["status_code"] == "404"]) + + methods = ["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE", "PATCH"] pattern = r'^([\d.]+) - - \[([^]]+)\] "([^"]*)" (\d+) (\d+) "([^"]*)" "([^"]*)" "-"$' @@ -43,10 +51,3 @@ print("No match found.") df = pd.DataFrame(data) - - -def __get_404_response_count(df): - """ - Provide the total amount of requests that have a '404' not found status code. - """ - return len(df[df["status_code"] == "404"])