Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
python-sdk: include "cancelled" in CrawlJob.status and exit wait loop on cancel (fixes #2190) (#2240)
Jeel Rupareliya57babbaf0998
diff --git a/.gitignore b/.gitignoreindex 1955a8183..79d3a4db1 100644--- a/.gitignore+++ b/.gitignore@@ -44,4 +44,6 @@ gke-key.jsonCLAUDE.local.md-*.egg-info/\ No newline at end of file+*.egg-info/+# local SDK venv+apps/python-sdk/.venv/diff --git a/apps/python-sdk/.gitignore b/apps/python-sdk/.gitignoreindex 386c77b22..5cd7c8b60 100644--- a/apps/python-sdk/.gitignore+++ b/apps/python-sdk/.gitignore@@ -1,4 +1,6 @@binbuildinclude-lib\ No newline at end of file+lib+# local venv+apps/python-sdk/.venv/diff --git a/apps/python-sdk/firecrawl/v2/methods/crawl.py b/apps/python-sdk/firecrawl/v2/methods/crawl.pyindex abcce4902..64f0c6d3f 100644--- a/apps/python-sdk/firecrawl/v2/methods/crawl.py+++ b/apps/python-sdk/firecrawl/v2/methods/crawl.py@@ -333,7 +333,7 @@ def wait_for_crawl_completion(crawl_job = get_crawl_status(client, job_id)# Check if job is complete- if crawl_job.status in ["completed", "failed"]:+ if crawl_job.status in ["completed", "failed", "cancelled"]:return crawl_job# Check timeoutdiff --git a/apps/python-sdk/firecrawl/v2/types.py b/apps/python-sdk/firecrawl/v2/types.pyindex 10a436869..5b37a6776 100644--- a/apps/python-sdk/firecrawl/v2/types.py+++ b/apps/python-sdk/firecrawl/v2/types.py@@ -348,7 +348,7 @@ class CrawlResponse(BaseModel):class CrawlJob(BaseModel):"""Crawl job status and progress data."""- status: Literal["scraping", "completed", "failed"]+ status: Literal["scraping", "completed", "failed", "cancelled"]total: int = 0completed: int = 0credits_used: int = 0