- Aktualisierung der Pains/Gains für Energy, Retail und Tech in der lokalen DB. - Ergänzung von Secondary Products für Energy & Tech. - Aufbau eines permanenten Werkzeugkastens unter /app/devtools/ für DB- & Notion-Tasks. - Verifikation der manuellen Notion-Änderungen mittels neuer Maintenance-Skripte.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import os
|
|
import requests
|
|
import json
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
# Check for API Key
|
|
NOTION_API_KEY = os.getenv("NOTION_API_KEY")
|
|
if not NOTION_API_KEY:
|
|
try:
|
|
with open("/app/n8n_api_Token_git.txt", "r") as f:
|
|
content = f.read()
|
|
if "secret_" in content:
|
|
NOTION_API_KEY = content.strip().split('\n')[0]
|
|
except:
|
|
pass
|
|
|
|
if not NOTION_API_KEY:
|
|
print("Error: NOTION_API_KEY not found.")
|
|
exit(1)
|
|
|
|
NOTION_DB_ID = "2ec88f4285448014ab38ea664b4c2b81"
|
|
headers = {"Authorization": f"Bearer {NOTION_API_KEY}", "Notion-Version": "2022-06-28", "Content-Type": "application/json"}
|
|
|
|
def list_db_properties():
|
|
url = f"https://api.notion.com/v1/databases/{NOTION_DB_ID}"
|
|
resp = requests.get(url, headers=headers)
|
|
if resp.status_code == 200:
|
|
props = resp.json().get("properties", {})
|
|
print("Database Properties:")
|
|
for name, data in props.items():
|
|
print(f"- {name} (Type: {data['type']})")
|
|
else:
|
|
print(f"Error getting DB: {resp.text}")
|
|
|
|
if __name__ == "__main__":
|
|
list_db_properties()
|