From b3ee0a5cc6adb6444e59721f74bd49b22baebdbe Mon Sep 17 00:00:00 2001 From: brb Date: Mon, 10 Jul 2023 16:45:01 +0200 Subject: [PATCH] added function to measure bandwidth --- code/bandwidth.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 code/bandwidth.py diff --git a/code/bandwidth.py b/code/bandwidth.py new file mode 100644 index 0000000..44c0e0a --- /dev/null +++ b/code/bandwidth.py @@ -0,0 +1,22 @@ +from speedtest import Speedtest +from dotenv import load_dotenv +from typing import List + + +def measure(): + """ + Measure bandwidth usiing Ookla/speedtest. + """ + s = Speedtest() + s.get_servers(servers=[]) + s.get_best_server() + s.download(threads=None) + s.upload(threads=None) + s.results.share() + return s.results.dict() + + +if __name__ == '__main__': + load_dotenv() + res = measure() + print(res)