Skip to content

Commit

Permalink
Pulling Directory Id from secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-moore-97 committed Jan 10, 2024
1 parent 7d7ad87 commit 1133624
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions qualtrix/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fastapi import HTTPException
from pydantic import BaseModel, typing

from qualtrix import client, error
from qualtrix import client, error, settings

log = logging.getLogger(__name__)

Expand All @@ -28,7 +28,6 @@ class SessionModel(SurveyModel):


class RedirectModel(SurveyModel):
directoryId: str
targetSurveyId: str
responseId: str

Expand All @@ -50,8 +49,8 @@ async def get_response(request: ResponseModel):
async def get_redirect(request: RedirectModel):
try:
email = client.get_email(request.surveyId, request.responseId)
contact = client.get_contact(request.directoryId, email)
distribution = client.get_distribution(request.directoryId, contact["id"])
contact = client.get_contact(settings.directory_id, email)
distribution = client.get_distribution(settings.directory_id, contact["id"])
return client.get_link(request.targetSurveyId, distribution["distributionId"])
except error.QualtricsError as e:
logging.error(e)
Expand Down

0 comments on commit 1133624

Please sign in to comment.