def get_email_addresses(survey, startdate, enddate):
 token = settings.SURVEYGIZMO_API_TOKEN
 secret = settings.SURVEYGIZMO_API_TOKEN_SECRET
 emails = []
 page = 1
 more_pages = True
 survey_id = SURVEYS[survey]['email_collection_survey_id']
 if ((token is None) or (secret is None)):
  return emails
 while more_pages:
  response = requests.get('https://restapi.surveygizmo.com/v2/survey/{survey}/surveyresponse?filter[field][0]=datesubmitted&filter[operator][0]=>=&filter[value][0]={start}+0:0:0filter[field][1]=datesubmitted&filter[operator][1]=<&filter[value][1]={end}+0:0:0&filter[field][2]=status&filter[operator][2]==&filter[value][2]=Complete&resultsperpage=500&page={page}&api_token={token}&api_token_secret={secret}'.format(survey=survey_id, start=startdate, end=enddate, page=page, token=token, secret=secret), timeout=300)
  results = json.loads(response.content)
  total_pages = results['total_pages']
  more_pages = (page < total_pages)
  emails = (emails + [r['[question(13)]'] for r in results['data']])
  page += 1
 return emails

def get_email_addresses ( survey , startdate , enddate ) : token = settings . SURVEYGIZMO_API_TOKEN secret = settings . SURVEYGIZMO_API_TOKEN_SECRET emails = [ ] page = 1 more_pages = True survey_id = SURVEYS [ survey ] [ 'email_collection_survey_id' ] if ( ( token is None ) or ( secret is None ) ) : return emails while more_pages : response = requests . get ( 'https://restapi.surveygizmo.com/v2/survey/{survey}/surveyresponse?filter[field][0]=datesubmitted&filter[operator][0]=>=&filter[value][0]={start}+0:0:0filter[field][1]=datesubmitted&filter[operator][1]=<&filter[value][1]={end}+0:0:0&filter[field][2]=status&filter[operator][2]==&filter[value][2]=Complete&resultsperpage=500&page={page}&api_token={token}&api_token_secret={secret}' . format ( survey = survey_id , start = startdate , end = enddate , page = page , token = token , secret = secret ) , timeout = 300 ) results = json . loads ( response . content ) total_pages = results [ 'total_pages' ] more_pages = ( page < total_pages ) emails = ( emails + [ r [ '[question(13)]' ] for r in results [ 'data' ] ] ) page += 1 return emails
get the email addresses collected between startdate and enddate .