1313SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
1414"""
1515
16- import os
17- import sys
1816import argparse
1917import base64
18+ import os
19+ import sys
2020
2121# Import generated protobuf modules
2222try :
23- from request_pb2 import Request , WifiConfig , EnterpriseCertConfig
24- from common_pb2 import WifiInfo , AuthMode , Band , OpCode
23+ from common_pb2 import AuthMode , Band , OpCode , WifiInfo
24+ from request_pb2 import EnterpriseCertConfig , Request , WifiConfig
2525except ImportError :
2626 print ("Error: Python protobuf defigdnitions not found." )
2727 print ("Please ensure the CMake build has generated the protobuf files." )
@@ -47,8 +47,8 @@ def read_cert_file(file_path):
4747 try :
4848 with open (file_path , 'rb' ) as f :
4949 return f .read ()
50- except IOError as e :
51- raise IOError (f"Failed to read certificate file { file_path } : { e } " )
50+ except OSError as e :
51+ raise OSError (f"Failed to read certificate file { file_path } : { e } " )
5252
5353def check_required_files (cert_dir ):
5454 """Check if all required certificate files exist.
@@ -289,6 +289,7 @@ def main():
289289 # Show JSON only if requested
290290 if args .json :
291291 import json
292+
292293 from google .protobuf .json_format import MessageToDict
293294
294295 json_data = MessageToDict (request , preserving_proto_field_name = True )
@@ -306,6 +307,7 @@ def main():
306307 if args .json :
307308 # Save as JSON
308309 import json
310+
309311 from google .protobuf .json_format import MessageToDict
310312 json_data = MessageToDict (request , preserving_proto_field_name = True )
311313 with open (args .output , 'w' ) as f :
@@ -350,17 +352,17 @@ def main():
350352 }
351353 auth_name = auth_names .get (args .auth_mode , f"Unknown({ args .auth_mode } )" )
352354
353- print (f "\n Configuration details:" )
355+ print ("\n Configuration details:" )
354356 print (f" SSID: { args .ssid } " )
355357 print (f" BSSID: { args .bssid } " )
356358 print (f" Channel: { args .channel } " )
357359 print (f" Band: { '2.4GHz' if args .band == 1 else '5GHz' } " )
358360 print (f" Auth: { auth_name } " )
359361 if args .cert_dir :
360- print (f " Mode: EAP-TLS" )
362+ print (" Mode: EAP-TLS" )
361363 print (f" Identity: { args .identity } " )
362364 elif args .passphrase :
363- print (f " Mode: Personal" )
365+ print (" Mode: Personal" )
364366 print (f" Passphrase: { '*' * len (args .passphrase )} " )
365367
366368if __name__ == "__main__" :
0 commit comments