def add_email_to_campaign(survey, email):
 token = settings.SURVEYGIZMO_API_TOKEN
 secret = settings.SURVEYGIZMO_API_TOKEN_SECRET
 if ((token is None) or (secret is None)):
  return
 survey_id = SURVEYS[survey]['exit_survey_id']
 campaign_id = SURVEYS[survey]['exit_survey_campaign_id']
 try:
  requests.put('https://restapi.surveygizmo.com/v2/survey/{survey}/surveycampaign/{campaign}/contact?semailaddress={email}&api_token={token}&api_token_secret={secret}'.format(survey=survey_id, campaign=campaign_id, email=email, token=token, secret=secret), timeout=30)
 except requests.exceptions.Timeout:
  print ('Timedout adding: %s' % email)

def add_email_to_campaign ( survey , email ) : token = settings . SURVEYGIZMO_API_TOKEN secret = settings . SURVEYGIZMO_API_TOKEN_SECRET if ( ( token is None ) or ( secret is None ) ) : return survey_id = SURVEYS [ survey ] [ 'exit_survey_id' ] campaign_id = SURVEYS [ survey ] [ 'exit_survey_campaign_id' ] try : requests . put ( 'https://restapi.surveygizmo.com/v2/survey/{survey}/surveycampaign/{campaign}/contact?semailaddress={email}&api_token={token}&api_token_secret={secret}' . format ( survey = survey_id , campaign = campaign_id , email = email , token = token , secret = secret ) , timeout = 30 ) except requests . exceptions . Timeout : print ( 'Timedout adding: %s' % email )
add email to the exit survey campaign .