Skip to content

fix: handle firecrawl SDK API change for ScrapeOptions import#262

Open
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:fix/issue-255-firecrawl-scrape-options-import
Open

fix: handle firecrawl SDK API change for ScrapeOptions import#262
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:fix/issue-255-firecrawl-scrape-options-import

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #255

Problem

The firecrawl-py SDK changed where ScrapeOptions is exported across major versions:

  • Old API (pre-2.0): from firecrawl import FirecrawlApp, ScrapeOptions
  • Mid API: from firecrawl.types import ScrapeOptions
  • New API: V1ScrapeOptions at the top-level package

This causes an ImportError: cannot import name 'ScrapeOptions' from 'firecrawl' at startup, preventing the entire package from importing even when FireCrawl is not configured as the active web crawler.

Solution

Wrap the import with a try/except chain that tries each import path in order, so the module works across all firecrawl-py SDK versions.

Testing

Verified that the module imports successfully with both old and new firecrawl-py package versions by simulating the import fallback paths.

…illiztech#255)

The firecrawl-py SDK changed the location of ScrapeOptions across versions.
Use a try/except chain to support all SDK versions gracefully.
@sre-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: octo-patch
To complete the pull request process, please assign xiaofan-luan after the PR has been reviewed.
You can assign the PR to them by writing /assign @xiaofan-luan in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@octo-patch
Copy link
Copy Markdown
Author

/assign @xiaofan-luan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run issue

3 participants