Skip to content

Commit bf6966f

Browse files
authored
Merge pull request #811 from airweave-ai/fix/notion-validation
fix(notion): validate method
2 parents 8f0e2eb + 3dcc306 commit bf6966f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

backend/airweave/platform/sources/notion.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,21 @@ async def create(cls, access_token, config: Optional[Dict[str, Any]] = None) ->
9292
except Exception:
9393
pass
9494
try:
95-
instance.batch_size = int(config.get("batch_size", instance.batch_size))
95+
instance.batch_size = int(config.get("batch_size", 30))
9696
except Exception:
9797
pass
9898
# Rebuild the gate in case batch_size changed
9999
instance._materialize_semaphore = asyncio.Semaphore(instance.batch_size)
100100

101101
return instance
102102

103+
async def validate(self) -> bool:
104+
"""Validate the Notion source."""
105+
return await self._validate_oauth2(
106+
ping_url="https://api.notion.com/v1/users/me",
107+
headers={"Notion-Version": "2022-06-28"},
108+
)
109+
103110
def __init__(self):
104111
"""Initialize rate limiting state and tracking."""
105112
super().__init__()
@@ -1377,4 +1384,5 @@ async def _process_presigned_file(
13771384
except Exception as e:
13781385
self.logger.error(f"Error processing pre-signed file {file_entity.name}: {e}")
13791386
return None
1380-
# Removed lazy page entity creation and related helpers to simplify to eager-only generation
1387+
1388+
# Removed lazy page entity creation and related helpers to simplify to eager-only generation

0 commit comments

Comments
 (0)