From cb605f299c4f9e5a75111869963b5d34aecd6ab3 Mon Sep 17 00:00:00 2001 From: SafetyQuincyF Date: Wed, 30 Oct 2024 16:39:12 -0700 Subject: [PATCH] fix --- safety/auth/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/safety/auth/utils.py b/safety/auth/utils.py index 922d949a..7925e365 100644 --- a/safety/auth/utils.py +++ b/safety/auth/utils.py @@ -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