Update firecrawl.py

This commit is contained in:
Nicolas 2024-10-13 14:01:25 -03:00
parent 03287821c2
commit ec238a8349

View File

@ -117,7 +117,14 @@ class FirecrawlApp:
idempotency_key (Optional[str]): A unique uuid key to ensure idempotency of requests. idempotency_key (Optional[str]): A unique uuid key to ensure idempotency of requests.
Returns: Returns:
Any: The crawl job ID or the crawl results if waiting until completion. Dict[str, Any]: A dictionary containing the crawl results. The structure includes:
- 'success' (bool): Indicates if the crawl was successful.
- 'status' (str): The final status of the crawl job (e.g., 'completed').
- 'completed' (int): Number of scraped pages that completed.
- 'total' (int): Total number of scraped pages.
- 'creditsUsed' (int): Estimated number of API credits used for this crawl.
- 'expiresAt' (str): ISO 8601 formatted date-time string indicating when the crawl data expires.
- 'data' (List[Dict]): List of all the scraped pages.
Raises: Raises:
Exception: If the crawl job initiation or monitoring fails. Exception: If the crawl job initiation or monitoring fails.
@ -146,7 +153,10 @@ class FirecrawlApp:
idempotency_key (Optional[str]): A unique uuid key to ensure idempotency of requests. idempotency_key (Optional[str]): A unique uuid key to ensure idempotency of requests.
Returns: Returns:
Dict[str, Any]: The response from the crawl initiation request. Dict[str, Any]: A dictionary containing the crawl initiation response. The structure includes:
- 'success' (bool): Indicates if the crawl initiation was successful.
- 'id' (str): The unique identifier for the crawl job.
- 'url' (str): The URL to check the status of the crawl job.
""" """
endpoint = f'/v1/crawl' endpoint = f'/v1/crawl'
headers = self._prepare_headers(idempotency_key) headers = self._prepare_headers(idempotency_key)
@ -236,7 +246,7 @@ class FirecrawlApp:
params (Optional[Dict[str, Any]]): Additional parameters for the map search. params (Optional[Dict[str, Any]]): Additional parameters for the map search.
Returns: Returns:
Any: The result of the map search, typically a dictionary containing mapping data. List[str]: A list of URLs discovered during the map search.
""" """
endpoint = f'/v1/map' endpoint = f'/v1/map'
headers = self._prepare_headers() headers = self._prepare_headers()