Skip to content

Commit 076ca5d

Browse files
authored
ref(wsgi): Use new scopes API (#2894)
1 parent 9a98ceb commit 076ca5d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sentry_sdk/integrations/_wsgi_common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import json
22
from copy import deepcopy
33

4-
from sentry_sdk.hub import Hub, _should_send_default_pii
4+
import sentry_sdk
5+
from sentry_sdk.scope import should_send_default_pii
56
from sentry_sdk.utils import AnnotatedValue
67
from sentry_sdk._types import TYPE_CHECKING
78

@@ -12,8 +13,6 @@
1213

1314

1415
if TYPE_CHECKING:
15-
import sentry_sdk
16-
1716
from typing import Any
1817
from typing import Dict
1918
from typing import Mapping
@@ -67,16 +66,16 @@ def __init__(self, request):
6766

6867
def extract_into_event(self, event):
6968
# type: (Event) -> None
70-
client = Hub.current.client
71-
if client is None:
69+
client = sentry_sdk.get_client()
70+
if not client.is_active():
7271
return
7372

7473
data = None # type: Optional[Union[AnnotatedValue, Dict[str, Any]]]
7574

7675
content_length = self.content_length()
7776
request_info = event.get("request", {})
7877

79-
if _should_send_default_pii():
78+
if should_send_default_pii():
8079
request_info["cookies"] = dict(self.cookies())
8180

8281
if not request_body_within_bounds(client, content_length):
@@ -190,7 +189,7 @@ def _is_json_content_type(ct):
190189

191190
def _filter_headers(headers):
192191
# type: (Mapping[str, str]) -> Mapping[str, Union[AnnotatedValue, str]]
193-
if _should_send_default_pii():
192+
if should_send_default_pii():
194193
return headers
195194

196195
return {

0 commit comments

Comments
 (0)