Skip to content

Support sentry-sdk 3 in SentryReporter - #49

Merged
jjsaunier merged 4 commits into
scrapfly:masterfrom
itzzdev09:support-sentry-sdk-3
Nov 29, 2026
Merged

jjsaunier merged 4 commits into
scrapfly:masterfrom
itzzdev09:support-sentry-sdk-3

Conversation

@itzzdev09

Copy link
Copy Markdown
Contributor

sentry-sdk 3.0.0 (released this month) removed push_scope. SentryReporter imports it when it reports, so with a current sentry-sdk the reporter itself raises and the scrape error never reaches Sentry:

ImportError: cannot import name 'push_scope' from 'sentry_sdk'

This uses sentry_sdk.new_scope() (available since 2.0) and falls back to push_scope() on 1.x.

Added tests/test_sentry_reporter.py, which reports a fake error and checks the tags and extras on the captured event. Results on python:3.13:

sentry-sdk before after
1.45.1 passes passes
2.77.0 passes (deprecation warning) passes
3.0.1 fails with the ImportError passes

@jjsaunier
jjsaunier merged commit 544ac51 into scrapfly:master Nov 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants