18 lines
555 B
Python
18 lines
555 B
Python
"""API 키 관리 - api_keys.json에서 읽기"""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def load_api_keys():
|
|
"""프로젝트 폴더의 api_keys.json에서 API 키 로딩"""
|
|
search_path = Path(__file__).resolve().parent
|
|
for _ in range(5):
|
|
key_file = search_path / 'api_keys.json'
|
|
if key_file.exists():
|
|
with open(key_file, 'r', encoding='utf-8') as f:
|
|
return json.load(f)
|
|
search_path = search_path.parent
|
|
print("warning: api_keys.json not found")
|
|
return {}
|
|
|
|
API_KEYS = load_api_keys()
|