Skip to content

Commit

Permalink
adds aws key accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
suryabulusu committed May 22, 2024
1 parent 1f3ea7b commit 6124420
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions app/routers/quizzes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
from logger_config import get_logger
import json
import boto3
import os

sns_client = boto3.client("sns")
sns_client = boto3.client(
"sns",
region_name="ap-south-1",
aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
)

router = APIRouter(prefix="/quiz", tags=["Quiz"])
settings = Settings()
Expand Down Expand Up @@ -256,7 +262,7 @@ async def generate_review_quiz(review_params: GenerateReviewQuiz):
Message=json.dumps(message),
MessageStructure="string",
)
if response.status == 200:
if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
print(
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
Expand Down
13 changes: 10 additions & 3 deletions app/routers/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
)
from datetime import datetime
from logger_config import get_logger
import os
import boto3
import json

sns_client = boto3.client("sns")
sns_client = boto3.client(
"sns",
region_name="ap-south-1",
aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
)


def str_to_datetime(datetime_str: str) -> datetime:
Expand Down Expand Up @@ -322,7 +328,7 @@ async def get_session(session_id: str):
)


@router.get("/generate-review")
@router.post("/generate-review")
async def generate_review_quiz_for_session(review_params: GenerateReviewQuizForSession):
review_params = jsonable_encoder(review_params)
user_id = review_params["user_id"]
Expand Down Expand Up @@ -351,7 +357,8 @@ async def generate_review_quiz_for_session(review_params: GenerateReviewQuizForS
Message=json.dumps(message),
MessageStructure="string",
)
if response.status == 200:

if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
print(
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
Expand Down

0 comments on commit 6124420

Please sign in to comment.