#!/usr/bin/env python3 """Write U28-U36 allocation to Feishu doc""" import json import subprocess import requests # Get token config = json.load(open('/root/.openclaw/credentials/xiaobian/config.json')) app_id = config['apps'][0]['appId'] app_secret = config['apps'][0]['appSecret'] resp = requests.post('https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal', json={'app_id': app_id, 'app_secret': app_secret}) token = resp.json()['tenant_access_token'] doc_id = 'EbSrd0a8aorg4jxDsrucXpqwnQc' # Get document block id (root) resp = requests.get(f'https://open.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks/{doc_id}', headers={'Authorization': f'Bearer {token}'}) root_data = resp.json() print(json.dumps(root_data, indent=2, ensure_ascii=False)[:500])