Skip to content

Commit 819fa0d

Browse files
ref: Use scope.should_send_default_pii in FastAPI integration (getsentry#2846)
* Created async and sync decorators * Added use of each sentry decorator * Fix circular import * Revert changes to starlette.py * Rename method * Use actual generics, move async implementation to utils * Refactor parameters * Undo changes to _types.py * Use client instead of Hub * Add doc string * Move type comments * Fix mypy * Fix circular import * Added unit tests for decorators * Revert gql changes * Revert "Revert gql changes" This reverts commit 85c1a1f. * ref: Shortcut for `should_send_default_pii` * revert gql changes * ref: Use `scope.should_send_default_pii` in FastAPI integration
1 parent a046901 commit 819fa0d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

sentry_sdk/integrations/fastapi.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sentry_sdk
66
from sentry_sdk._types import TYPE_CHECKING
77
from sentry_sdk.integrations import DidNotEnable
8-
from sentry_sdk.scope import Scope
8+
from sentry_sdk.scope import Scope, should_send_default_pii
99
from sentry_sdk.tracing import SOURCE_FOR_STYLE, TRANSACTION_SOURCE_ROUTE
1010
from sentry_sdk.utils import (
1111
transaction_from_function,
@@ -118,10 +118,7 @@ def event_processor(event, hint):
118118
# Extract information from request
119119
request_info = event.get("request", {})
120120
if info:
121-
if (
122-
"cookies" in info
123-
and sentry_sdk.get_client().should_send_default_pii()
124-
):
121+
if "cookies" in info and should_send_default_pii():
125122
request_info["cookies"] = info["cookies"]
126123
if "data" in info:
127124
request_info["data"] = info["data"]

0 commit comments

Comments
 (0)