헤더 가지고 오는 부분 수정
This commit is contained in:
@ -10,11 +10,17 @@ from datetime import datetime
|
|||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||||
|
|
||||||
from lib.config import Config
|
from lib.config import Config
|
||||||
|
HEADERS = {
|
||||||
|
"Authorization": f"Bearer {Config.NOTION_API_SECRET}",
|
||||||
|
"Notion-Version": Config.NOTION_VERSION,
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
from lib.common import EVENT_TYPE_LABELS
|
from lib.common import EVENT_TYPE_LABELS
|
||||||
|
|
||||||
def get_page_details(page_id: str) -> Optional[Dict]:
|
def get_page_details(page_id: str) -> Optional[Dict]:
|
||||||
url = f"{Config.NOTION_API_BASE}/pages/{page_id}"
|
url = f"{Config.NOTION_API_BASE}/pages/{page_id}"
|
||||||
response = requests.get(url, headers=Config.HEADERS)
|
response = requests.get(url, headers=HEADERS)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json()
|
return response.json()
|
||||||
@ -157,7 +163,7 @@ def fetch_entity_detail(entity_type: str, entity_id: str) -> Optional[Dict]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=Config.HEADERS, timeout=5)
|
response = requests.get(url, headers=HEADERS, timeout=5)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user