[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Reset limit if test address



commit f08583579adfeac7f33494fee98e1f7a194423b0
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Mon Oct 14 18:53:16 2019 +0200

    Reset limit if test address
---
 gettor.conf.json.example |  1 +
 gettor/parse/email.py    | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gettor.conf.json.example b/gettor.conf.json.example
index bd5b71f..958785a 100644
--- a/gettor.conf.json.example
+++ b/gettor.conf.json.example
@@ -13,6 +13,7 @@
   "consumer_secret": "",
   "access_key": "",
   "access_secret": "",
+  "test_hid" = "",
   "twitter_handle": "get_tor",
   "twitter_messages_endpoint": "https://api.twitter.com/1.1/direct_messages/events/list.json";,
   "twitter_new_message_endpoint": "https://api.twitter.com/1.1/direct_messages/events/new.json";
diff --git a/gettor/parse/email.py b/gettor/parse/email.py
index 5d65a93..785c983 100644
--- a/gettor/parse/email.py
+++ b/gettor/parse/email.py
@@ -205,9 +205,14 @@ class EmailParser(object):
 
         hid = hashlib.sha256(request['id'].encode('utf-8'))
         # check limits first
-        num_requests = yield conn.get_num_requests(
-            id=hid.hexdigest(), service=request_service
-        )
+        num_requests = limit
+
+        if hid.hexdigest() == self.settings.get('test_hid'):
+            num_requests = 1
+        else:
+            num_requests = yield conn.get_num_requests(
+                id=hid.hexdigest(), service=request_service
+            )
 
         if num_requests[0][0] < email_requests_limit:
             return 1

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits