Skip to content

Commit

Permalink
Merge pull request #1951 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Merge dev to dev-server
  • Loading branch information
jelanmathewjames authored May 14, 2024
2 parents 9ba1ed6 + ae5e1c2 commit 7f274b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions api/integrations/wadhwani/wadhwani_views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import requests

from utils.response import CustomResponse
Expand Down Expand Up @@ -33,8 +34,9 @@ def post(self, request):

if not (course_root_id := request.data.get("course_root_id", None)):
return CustomResponse(general_message="Course Root ID is required").get_failure_response()

data = {

headers = {'Content-Type': 'application/json'}
data = json.dumps({
"name": user.full_name,
"candidateId": user.id,
"userName": user.email,
Expand All @@ -44,10 +46,12 @@ def post(self, request):
"userLanguageCode": "en",
"token": token,
"courseRootId": course_root_id
}
response = requests.post(url, data=data)
})
response = requests.post(url, headers=headers, data=data)

if response.json().get("status", None) == "ERROR":
return CustomResponse(general_message="Something went wrong").get_failure_response()
if response.json().get("status", None) == "FAILURE":
return CustomResponse(general_message="Invalid Input").get_failure_response()
return CustomResponse(response=response.json()).get_success_response()

Expand Down

0 comments on commit 7f274b2

Please sign in to comment.