aboutsummaryrefslogtreecommitdiffstats
path: root/api_plotter.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2025-06-07 23:43:52 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2025-06-07 23:43:52 +0100
commit2bdc35bd8159c6ccbb9d87f0abca25f6dd784f52 (patch)
tree2cd1c25a3de9566141b5530f5ca670175a32027b /api_plotter.py
parent1707d25fab29ea7df358aa29fb6894ba2fcc6eec (diff)
downloadSmallYTChannelBot-2bdc35bd8159c6ccbb9d87f0abca25f6dd784f52.tar.gz
SmallYTChannelBot-2bdc35bd8159c6ccbb9d87f0abca25f6dd784f52.zip
A lot of fixes and refactoring
Diffstat (limited to 'api_plotter.py')
-rwxr-xr-xapi_plotter.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/api_plotter.py b/api_plotter.py
deleted file mode 100755
index ba197e2..0000000
--- a/api_plotter.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import matplotlib.pyplot as plt
-import datetime
-import math
-import os
-import re
-
-def round_to_min(dt: datetime.datetime):
- return datetime.datetime(
- year = dt.year,
- month = dt.month,
- day = dt.day,
- hour = dt.hour,
- minute = math.floor(dt.minute)
- )
-
-with open(os.path.join("logs", "api.log"), "r") as f:
- s = f.read().split("\n")
-
-timestamps = set()
-
-for l in s:
- x = re.search(r"^.*\tResponse: 200", l)
- if x is not None:
- timestamps.add(datetime.datetime.strptime(x.group()[1:24], "%Y-%m-%d %H:%M:%S,%f"))
-
-d = {}
-for timestamp in timestamps:
- nearest = round_to_min(timestamp)
-
- try:
- d[nearest] += 1
- except KeyError:
- d[nearest] = 1
-
-d_sorted = {k: v for k, v in sorted(d.items(), key=lambda x: x[0])}
-
-fig, ax = plt.subplots()
-ax.plot(list(d_sorted.keys()), list(d_sorted.values()))
-
-plt.show() \ No newline at end of file