From 0052efcc7bce80dd780674e1184c40143c9b3eb9 Mon Sep 17 00:00:00 2001
From: Bastien Le Querrec <blq@laquadrature.net>
Date: Sun, 17 Mar 2024 12:21:30 +0100
Subject: [PATCH] RAAspotter: ajout d'une fonction pour activer Tor

---
 RAAspotter.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/RAAspotter.py b/RAAspotter.py
index 403aff7..a8190fe 100644
--- a/RAAspotter.py
+++ b/RAAspotter.py
@@ -59,6 +59,17 @@ class RAAspotter:
     f.write('')
     f.close()
 
+  def enable_tor(self):
+    proxies = {
+      "http": f"socks5h://localhost:9050",
+      "https": f"socks5h://localhost:9050",
+    }
+    self.session.proxies.update(proxies)
+
+  def disable_tor(self):
+    proxies = {}
+    self.session.proxies.update(proxies)
+
   def get_sub_pages(self, page_content, element, host=""):
     soup = BeautifulSoup(page_content, 'html.parser')
     sub_pages = []
-- 
GitLab