diff --git a/agent/groupcal.py b/agent/groupcal.py index 07e7af7..5777381 100644 --- a/agent/groupcal.py +++ b/agent/groupcal.py @@ -12,16 +12,20 @@ from optparse import OptionParser import sqlite3 import datetime -from xml.dom.minidom import Document from pythonzimbra.communication import Communication from pythonzimbra.tools import auth from pythonzimbra.tools.dict import get_value -from pythonzimbra.tools.xmlserializer import dict_to_dom +import time SEARCH_LIMIT = 100 """ How many results to fetch in one SearchRequest """ +WAIT_AFTER_SEARCH = 0.5 + +""" How many seconds (may be a fracture) to wait between to search requests ( +for DoS-Filter mitigation) """ + if __name__ == '__main__': # Parse options @@ -486,6 +490,10 @@ ) ) + # Wait some time to mitigate the DoS-Filter + + time.sleep(WAIT_AFTER_SEARCH) + if appt_response.get_response()["SearchResponse"]["more"] == 1: # We have more pages. Rerun the search @@ -494,6 +502,8 @@ search_params["offset"] = current_offset appt_request.clean() + + appt_request.set_auth_token(user_token) appt_request.add_request( "SearchRequest", search_params,