Skip to content

Commit

Permalink
Moved should_send_default_pii into client (#2840)
Browse files Browse the repository at this point in the history
Moved functionality from `_should_send_default_pii()` in `hub` into `should_send_default_pii` on the `Client`.
  • Loading branch information
antonpirker authored Mar 18, 2024
1 parent 84fd6be commit 0a47317
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ def is_active(self):
"""
return True

def should_send_default_pii(self):
# type: () -> bool
"""
.. versionadded:: 2.0.0
Returns whether the client should send default PII (Personally Identifiable Information) data to Sentry.
"""
return self.options.get("send_default_pii", False)

@property
def dsn(self):
# type: () -> Optional[str]
Expand Down
4 changes: 3 additions & 1 deletion sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ def overload(x):

def _should_send_default_pii():
# type: () -> bool
# TODO: Migrate existing code to client.should_send_default_pii() and remove this function.
# New code should not use this function!
client = Hub.current.client
if not client:
return False
return client.options["send_default_pii"]
return client.should_send_default_pii()


class _InitGuard:
Expand Down

0 comments on commit 0a47317

Please sign in to comment.