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()