From efc6b12c65f13fc7803d2432265022c9ca3792c5 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Sun, 30 Jun 2024 22:49:16 -0400 Subject: [PATCH 1/4] Make torrequest optional --- pyproject.toml | 3 +++ sherlock/sherlock.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fafa9f85f..bfbdac206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,9 @@ torrequest = "^0.1.0" pandas = ">=1.0.0,<3.0.0" openpyxl = "^3.0.10" +[tool.poetry.extras] +tor = ["torrequest"] + [tool.poetry.group.dev.dependencies] jsonschema = "^4.0.0" diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index db8e9c2cb..41e091861 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -30,7 +30,6 @@ ) from requests_futures.sessions import FuturesSession # noqa: E402 -from torrequest import TorRequest # noqa: E402 from sherlock.result import QueryStatus # noqa: E402 from sherlock.result import QueryResult # noqa: E402 from sherlock.notify import QueryNotify # noqa: E402 @@ -206,6 +205,15 @@ def sherlock( query_notify.start(username) # Create session based on request methodology if tor or unique_tor: + try: + from torrequest import TorRequest # noqa: E402 + except ImportError: + print("Important!") + print("> Dependencies for --tor and --unique-tor are now optional, and WILL BE DEPRECATED in a future release of Sherlock.") + print("> If you've installed Sherlock via pipx, you can install the dependency with `pipx install sherlock-project[tor]`.") + print("> Other packages should refer to their packager maintainer's documentation, or install separately with `pipx install torrequest`.\n") + sys.exit(query_notify.finish()) + # Requests using Tor obfuscation try: underlying_request = TorRequest() From 2add15e92cd215d21a494dd1afe3e4951a8ec12b Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Sun, 30 Jun 2024 23:13:24 -0400 Subject: [PATCH 2/4] pipx -> pip --- sherlock/sherlock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 41e091861..48d29cf77 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -210,7 +210,7 @@ def sherlock( except ImportError: print("Important!") print("> Dependencies for --tor and --unique-tor are now optional, and WILL BE DEPRECATED in a future release of Sherlock.") - print("> If you've installed Sherlock via pipx, you can install the dependency with `pipx install sherlock-project[tor]`.") + print("> If you've installed Sherlock via pipx, you can install the dependency with `pip install sherlock-project[tor]`.") print("> Other packages should refer to their packager maintainer's documentation, or install separately with `pipx install torrequest`.\n") sys.exit(query_notify.finish()) From 27badf6b3d2627fe0b97f07384c94712a9819e22 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 8 Jul 2024 02:03:42 -0400 Subject: [PATCH 3/4] Update command hint --- sherlock/sherlock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 48d29cf77..1748514cc 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -210,8 +210,8 @@ def sherlock( except ImportError: print("Important!") print("> Dependencies for --tor and --unique-tor are now optional, and WILL BE DEPRECATED in a future release of Sherlock.") - print("> If you've installed Sherlock via pipx, you can install the dependency with `pip install sherlock-project[tor]`.") - print("> Other packages should refer to their packager maintainer's documentation, or install separately with `pipx install torrequest`.\n") + print("> If you've installed Sherlock via pip, you can install with the dependency with `pip install sherlock-project[tor]`.") + print("> Other packages should refer to their documentation, or install separately with `pip install torrequest`.\n") sys.exit(query_notify.finish()) # Requests using Tor obfuscation From f79bbfcdc1b40c01a8295984a0513f9087a4a752 Mon Sep 17 00:00:00 2001 From: Paul Pfeister Date: Mon, 8 Jul 2024 04:10:53 -0400 Subject: [PATCH 4/4] Update message --- sherlock/sherlock.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 1748514cc..a4bd5bc76 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -209,11 +209,14 @@ def sherlock( from torrequest import TorRequest # noqa: E402 except ImportError: print("Important!") - print("> Dependencies for --tor and --unique-tor are now optional, and WILL BE DEPRECATED in a future release of Sherlock.") - print("> If you've installed Sherlock via pip, you can install with the dependency with `pip install sherlock-project[tor]`.") - print("> Other packages should refer to their documentation, or install separately with `pip install torrequest`.\n") + print("> --tor and --unique-tor are now DEPRECATED, and may be removed in a future release of Sherlock.") + print("> If you've installed Sherlock via pip, you can include the optional dependency via `pip install sherlock-project[tor]`.") + print("> Other packages should refer to their documentation, or install it separately with `pip install torrequest`.\n") sys.exit(query_notify.finish()) + print("Important!") + print("> --tor and --unique-tor are now DEPRECATED, and may be removed in a future release of Sherlock.")) + # Requests using Tor obfuscation try: underlying_request = TorRequest()