if os.path.exists(self.settings_file_path): with open(self.settings_file_path, 'r') as file: try: settings = json.load(file) except: return {} # Decode the API key if 'api_ke
(self)
| 46 | json.dump(settings, file, indent=4) |
| 47 | |
| 48 | def load_settings_from_file(self) -> dict[str, str]: |
| 49 | """ |
| 50 | if os.path.exists(self.settings_file_path): |
| 51 | with open(self.settings_file_path, 'r') as file: |
| 52 | try: |
| 53 | settings = json.load(file) |
| 54 | except: |
| 55 | return {} |
| 56 | |
| 57 | # Decode the API key |
| 58 | if 'api_key' in settings: |
| 59 | decoded_api_key = base64.b64decode(settings['api_key']).decode() |
| 60 | settings['api_key'] = decoded_api_key |
| 61 | |
| 62 | return settings |
| 63 | else: |
| 64 | return {} |
| 65 | """ |
| 66 | settings: dict[str, str] = self._read_settings_file() |
| 67 | # Decode the API keys |
| 68 | if 'api_key' in settings: |
| 69 | decoded_api_key = base64.b64decode(settings['api_key']).decode() |
| 70 | settings['api_key'] = decoded_api_key |
| 71 | |
| 72 | return settings |
no test coverage detected