Skip to content

Commit

Permalink
* Token-Fault on search with multiple pages fixed
Browse files Browse the repository at this point in the history
* DoS-mitigation wait time added
  • Loading branch information
dploeger committed Sep 18, 2014
1 parent e511c5d commit b4f186f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions agent/groupcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit b4f186f

Please sign in to comment.