notion_api에서 사용하던 정보를 config.py 로 이동
This commit is contained in:
@ -13,8 +13,8 @@ from lib.config import Config
|
||||
from lib.common import EVENT_TYPE_LABELS
|
||||
|
||||
def get_page_details(page_id: str) -> Optional[Dict]:
|
||||
url = f"{NOTION_API_BASE}/pages/{page_id}"
|
||||
response = requests.get(url, headers=HEADERS)
|
||||
url = f"{Config.NOTION_API_BASE}/pages/{page_id}"
|
||||
response = requests.get(url, headers=Config.HEADERS)
|
||||
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
@ -147,17 +147,17 @@ def fetch_entity_detail(entity_type: str, entity_id: str) -> Optional[Dict]:
|
||||
"""
|
||||
url = None
|
||||
if entity_type == "page":
|
||||
url = f"{NOTION_API_BASE}/pages/{entity_id}"
|
||||
url = f"{Config.NOTION_API_BASE}/pages/{entity_id}"
|
||||
elif entity_type == "database":
|
||||
url = f"{NOTION_API_BASE}/databases/{entity_id}"
|
||||
url = f"{Config.NOTION_API_BASE}/databases/{entity_id}"
|
||||
elif entity_type == "block":
|
||||
url = f"{NOTION_API_BASE}/blocks/{entity_id}/children"
|
||||
url = f"{Config.NOTION_API_BASE}/blocks/{entity_id}/children"
|
||||
else:
|
||||
logging.warning(f"알 수 없는 entity_type: {entity_type}")
|
||||
return None
|
||||
|
||||
try:
|
||||
response = requests.get(url, headers=HEADERS, timeout=5)
|
||||
response = requests.get(url, headers=Config.HEADERS, timeout=5)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user