mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 07:51:52 +09:00
Add function to read sensitive data from .sensitive.json file
- Implemented GetSensitiveData function to load sensitive data from a JSON file. - Added error handling for missing file scenario.
This commit is contained in:
parent
29d91bac56
commit
1b65693ba5
6 changed files with 77 additions and 13 deletions
21
lib/utils/browser_use/sensitive_data.py
Normal file
21
lib/utils/browser_use/sensitive_data.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# read json file .sensitive.json
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
def GetSensitiveData():
|
||||
"""
|
||||
Reads sensitive data from a .sensitive.json file in the current directory.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the sensitive data.
|
||||
"""
|
||||
file_path = os.path.join(os.getcwd(), '.sensitive.json')
|
||||
|
||||
if not os.path.exists(file_path):
|
||||
raise FileNotFoundError(f"The file {file_path} does not exist.")
|
||||
|
||||
with open(file_path, 'r') as file:
|
||||
sensitive_data = json.load(file)
|
||||
|
||||
return sensitive_data
|
||||
Loading…
Add table
Add a link
Reference in a new issue