Skip to content

Commit

Permalink
replace python with jq
Browse files Browse the repository at this point in the history
  • Loading branch information
thedannywahl committed Jul 13, 2019
1 parent 9cd7de2 commit b337b50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commons/commons
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ fi

# START SESSION ################################################################
# ##############################################################################
JWT=$(curl $curlopts -H "Authorization: Bearer $canvas_token" -X GET "https://$canvas_domain.instructure.com/api/lti/accounts/self/jwt_token?tool_launch_url=https://lor.instructure.com/api/lti" | python -c 'import sys, json; print json.load(sys.stdin)["jwt_token"]')
JWT=$(curl $curlopts -H "Authorization: Bearer $canvas_token" -X GET "https://$canvas_domain.instructure.com/api/lti/accounts/self/jwt_token?tool_launch_url=https://lor.instructure.com/api/lti" | jq -r .jwt_token)
if [ $? -gt 0 ]; then
printf >&2 "Unable to generate a JSON Web Token. Please ensure that your credentials are accurate.\r\n"
exit 2
fi
session=$(curl $curlopts -H "Content-Type: application/json" --data '{"jwt_token":"'$JWT'"}' -X POST "https://lor.instructure.com/api/sessions" | python -c 'import sys, json; print json.load(sys.stdin)["sessionId"]')
session=$(curl $curlopts -H "Content-Type: application/json" --data '{"jwt_token":"'$JWT'"}' -X POST "https://lor.instructure.com/api/sessions" | jq -r .sessionId)
if [ $? -gt 0 ]; then
printf >&2 "Unable to generate a session. Please ensure that your credentials are accurate.\r\n"
exit 2
Expand Down

0 comments on commit b337b50

Please sign in to comment.