|
1 | 1 | import json
|
2 | 2 | from copy import deepcopy
|
3 | 3 |
|
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 |
5 | 6 | from sentry_sdk.utils import AnnotatedValue
|
6 | 7 | from sentry_sdk._types import TYPE_CHECKING
|
7 | 8 |
|
|
12 | 13 |
|
13 | 14 |
|
14 | 15 | if TYPE_CHECKING:
|
15 |
| - import sentry_sdk |
16 |
| - |
17 | 16 | from typing import Any
|
18 | 17 | from typing import Dict
|
19 | 18 | from typing import Mapping
|
@@ -67,16 +66,16 @@ def __init__(self, request):
|
67 | 66 |
|
68 | 67 | def extract_into_event(self, event):
|
69 | 68 | # 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(): |
72 | 71 | return
|
73 | 72 |
|
74 | 73 | data = None # type: Optional[Union[AnnotatedValue, Dict[str, Any]]]
|
75 | 74 |
|
76 | 75 | content_length = self.content_length()
|
77 | 76 | request_info = event.get("request", {})
|
78 | 77 |
|
79 |
| - if _should_send_default_pii(): |
| 78 | + if should_send_default_pii(): |
80 | 79 | request_info["cookies"] = dict(self.cookies())
|
81 | 80 |
|
82 | 81 | if not request_body_within_bounds(client, content_length):
|
@@ -190,7 +189,7 @@ def _is_json_content_type(ct):
|
190 | 189 |
|
191 | 190 | def _filter_headers(headers):
|
192 | 191 | # type: (Mapping[str, str]) -> Mapping[str, Union[AnnotatedValue, str]]
|
193 |
| - if _should_send_default_pii(): |
| 192 | + if should_send_default_pii(): |
194 | 193 | return headers
|
195 | 194 |
|
196 | 195 | return {
|
|
0 commit comments