[30388f42] Keine neuen Commits in dieser Session.
Keine neuen Commits in dieser Session.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"task_id": "31f88f42-8544-80ad-9573-e9f7f398e8b1", "token": "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", "readme_path": "connector-superoffice/README.md", "session_start_time": "2026-03-10T14:01:26.654688"}
|
{"task_id": "30388f42-8544-8088-bc48-e59e9b973e91", "token": "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", "readme_path": "readme.md", "session_start_time": "2026-03-10T19:23:35.891681"}
|
||||||
29
check_notion_task.py
Normal file
29
check_notion_task.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
token = os.environ.get('NOTION_API_KEY')
|
||||||
|
db_name = "Tasks [UT]"
|
||||||
|
|
||||||
|
def find_database_id(token, title):
|
||||||
|
url = "https://api.notion.com/v1/search"
|
||||||
|
headers = {"Authorization": f"Bearer {token}", "Notion-Version": "2022-06-28"}
|
||||||
|
payload = {"query": title, "filter": {"value": "database", "property": "object"}}
|
||||||
|
res = requests.post(url, headers=headers, json=payload)
|
||||||
|
for db in res.json().get("results", []):
|
||||||
|
if db["title"][0]["plain_text"] == title:
|
||||||
|
return db["id"]
|
||||||
|
return None
|
||||||
|
|
||||||
|
db_id = find_database_id(token, db_name)
|
||||||
|
if db_id:
|
||||||
|
url = f"https://api.notion.com/v1/databases/{db_id}/query"
|
||||||
|
headers = {"Authorization": f"Bearer {token}", "Notion-Version": "2022-06-28"}
|
||||||
|
res = requests.post(url, headers=headers)
|
||||||
|
tasks = res.json().get("results", [])
|
||||||
|
for task in tasks:
|
||||||
|
tid = task["id"]
|
||||||
|
title = task["properties"]["Name"]["title"][0]["plain_text"]
|
||||||
|
print(f"Task: {title} | ID: {tid}")
|
||||||
Reference in New Issue
Block a user