-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_database.py
More file actions
48 lines (38 loc) 路 1.2 KB
/
Copy pathcheck_database.py
File metadata and controls
48 lines (38 loc) 路 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Pr眉ft die Datenbank-Properties
"""
import os
import sys
import io
# Fix Windows Console Encoding
if sys.platform == 'win32':
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
from notion_client import Client
from dotenv import load_dotenv
# Lade Umgebungsvariablen
load_dotenv()
NOTION_TOKEN = os.getenv('NOTION_TOKEN')
DATABASE_ID = os.getenv('NOTION_DATABASE_ID')
notion = Client(auth=NOTION_TOKEN)
# Hole Datenbank-Info
database = notion.databases.retrieve(database_id=DATABASE_ID)
print("=" * 60)
print("馃搳 Datenbank-Eigenschaften")
print("=" * 60)
print(f"\nDatenbank-Name: {database['title'][0]['plain_text']}")
print(f"Database-ID: {DATABASE_ID}")
if 'properties' in database:
print(f"\nProperties:")
for prop_name, prop_data in database['properties'].items():
prop_type = prop_data['type']
print(f" - {prop_name}: {prop_type}")
else:
print("\nDebug - Database keys:")
print(list(database.keys()))
import json
print("\nFull database info:")
print(json.dumps(database, indent=2, ensure_ascii=False))
print("\n" + "=" * 60)