Commit 983dbbd6 authored by Hiro's avatar Hiro 🏄
Browse files

Fix bug in email and twitter parser

parent fca4f206
......@@ -150,6 +150,24 @@ class EmailParser(object):
return request
def check_num_requests(self, request_id, hid, request_service, limit):
# check limit first
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
else:
return 0
def parse(self, msg_str):
"""
Parse message content. Check if email address is well formed, if DKIM
......@@ -198,23 +216,6 @@ class EmailParser(object):
return request
def check_num_requests(self, request_id, hid, request_service, limit):
# check limit first
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
else:
return 0
@defer.inlineCallbacks
def parse_callback(self, request):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment