Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SafetyQuincyF committed Oct 30, 2024
1 parent d20679b commit cb605f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions safety/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,14 @@ def send(self, request: requests.PreparedRequest, **kwargs: Any) -> requests.Res
"""
request.headers.pop("Authorization", None)
return super().send(request, **kwargs)


def is_jupyter_notebook() -> bool:
"""Check if the code is being executed inside a Jupyter Notebook."""
try:
from IPython import get_ipython
if 'IPKernelApp' not in get_ipython().config:
return False
except Exception:
return False
return True

0 comments on commit cb605f2

Please sign in to comment.