mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 11:10:43 +08:00
chore: Import firecrawl integration package in FirecrawlCrawlApi and FirecrawlScrapeApi
This commit imports the firecrawl integration package in the FirecrawlCrawlApi and FirecrawlScrapeApi files. It ensures that the package is available for use in the code. If the package is not installed, an ImportError is raised with instructions to install it using `pip install firecrawl-py`.
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import uuid
|
||||
from typing import Optional
|
||||
from firecrawl.firecrawl import FirecrawlApp
|
||||
|
||||
from langflow.custom import CustomComponent
|
||||
from langflow.schema import Data
|
||||
import uuid
|
||||
|
||||
|
||||
class FirecrawlCrawlApi(CustomComponent):
|
||||
@ -48,11 +48,18 @@ class FirecrawlCrawlApi(CustomComponent):
|
||||
self,
|
||||
api_key: str,
|
||||
url: str,
|
||||
timeout: Optional[int] = 30000,
|
||||
timeout: int = 30000,
|
||||
crawlerOptions: Optional[Data] = None,
|
||||
pageOptions: Optional[Data] = None,
|
||||
idempotency_key: Optional[str] = None,
|
||||
) -> Data:
|
||||
try:
|
||||
from firecrawl.firecrawl import FirecrawlApp # type: ignore
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Could not import firecrawl integration package. " "Please install it with `pip install firecrawl-py`."
|
||||
)
|
||||
|
||||
if crawlerOptions:
|
||||
crawler_options_dict = crawlerOptions.__dict__["data"]["text"]
|
||||
else:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from typing import Optional
|
||||
from firecrawl.firecrawl import FirecrawlApp
|
||||
|
||||
from langflow.custom import CustomComponent
|
||||
from langflow.schema import Data
|
||||
|
||||
@ -47,6 +47,12 @@ class FirecrawlScrapeApi(CustomComponent):
|
||||
pageOptions: Optional[Data] = None,
|
||||
extractorOptions: Optional[Data] = None,
|
||||
) -> Data:
|
||||
try:
|
||||
from firecrawl.firecrawl import FirecrawlApp # type: ignore
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Could not import firecrawl integration package. " "Please install it with `pip install firecrawl-py`."
|
||||
)
|
||||
if extractorOptions:
|
||||
extractor_options_dict = extractorOptions.__dict__["data"]["text"]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user