From 51ed619e2fc6a0069cdc73684538e97250671cea316917ee8622b2118ff7b65f Mon Sep 17 00:00:00 2001 From: ranomier Date: Thu, 16 Jan 2025 03:38:03 +0100 Subject: [PATCH] split wifi file and put into new folder structure --- python/src/experimentation.py | 28 ++++++++++++++++++++++++++++ wifi.py => python/src/lib/wifi.py | 25 +------------------------ 2 files changed, 29 insertions(+), 24 deletions(-) create mode 100755 python/src/experimentation.py rename wifi.py => python/src/lib/wifi.py (84%) diff --git a/python/src/experimentation.py b/python/src/experimentation.py new file mode 100755 index 0000000..f12172b --- /dev/null +++ b/python/src/experimentation.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import argparse +import sys +from lib.wifi import get_wifi, connect + + +def main(): + try: + ap = argparse.ArgumentParser() + ap.add_argument("-j", "--json", help="just output current scanned wifi as json", action="store_true") + args = ap.parse_args() + + if args.json: + print(get_wifi()) + else: + my_dict = get_wifi() + for element in my_dict: + print(element) + my_input = input("wifi_name: ") + connect(my_input) + except KeyboardInterrupt: + print("") + print(">>> Interrupted by user") + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/wifi.py b/python/src/lib/wifi.py similarity index 84% rename from wifi.py rename to python/src/lib/wifi.py index 8066af5..5ad7903 100755 --- a/wifi.py +++ b/python/src/lib/wifi.py @@ -27,7 +27,7 @@ def _startup_check(): gathered_missing.append(binary) if gathered_missing: raise OSError("missing the following binaries: " + str(gathered_missing).strip("[]")) - +_startup_check() def _split_blocks(text: str) -> list: @@ -108,26 +108,3 @@ def connect(ssid: str) -> bool: return True -def main(): - _startup_check() - try: - ap = argparse.ArgumentParser() - ap.add_argument("-j", "--json", help="just output current scanned wifi as json", action="store_true") - args = ap.parse_args() - - if args.json: - print(get_wifi()) - else: - my_dict = get_wifi() - for element in my_dict: - print(element) - my_input = input("wifi_name: ") - connect(my_input) - except KeyboardInterrupt: - print("") - print(">>> Interrupted by user") - sys.exit(1) - - -if __name__ == "__main__": - main()