Files
dify-plugin-sdks/python/dify_plugin/interfaces/datasource/__init__.py
T
Yeuoly 8f5e27732c feat: add online document and website crawl datasource interfaces
- Introduced `OnlineDocumentDatasource` and `WebsiteCrawlDatasource` abstract classes for handling online document and website crawl functionalities.
- Added corresponding methods for retrieving pages and content, enhancing the datasource capabilities.
- Created new models for online document and website information to support the new interfaces.
2025-05-23 18:17:04 +08:00

29 lines
1.1 KiB
Python

from collections.abc import Mapping
from typing import Any
from werkzeug import Request
class DatasourceProvider:
"""
A provider for a datasource
"""
def validate_credentials(self, credentials: dict):
return self._validate_credentials(credentials)
def _validate_credentials(self, credentials: dict):
raise NotImplementedError("This method should be implemented by a subclass")
def oauth_get_authorization_url(self, system_credentials: Mapping[str, Any]) -> str:
return self._oauth_get_authorization_url(system_credentials)
def _oauth_get_authorization_url(self, system_credentials: Mapping[str, Any]) -> str:
raise NotImplementedError("This method should be implemented by a subclass")
def oauth_get_credentials(self, system_credentials: Mapping[str, Any], request: Request) -> Mapping[str, Any]:
return self._oauth_get_credentials(system_credentials, request)
def _oauth_get_credentials(self, system_credentials: Mapping[str, Any], request: Request) -> Mapping[str, Any]:
raise NotImplementedError("This method should be implemented by a subclass")