Skip to content

Commit

Permalink
Use the blessed get_json
Browse files Browse the repository at this point in the history
  • Loading branch information
robwaz committed Oct 7, 2024
1 parent 80047a5 commit faca36a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions dojo_plugin/api/v1/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from CTFd.models import db
from CTFd.utils.decorators import authed_only
from CTFd.utils.user import get_current_user
from CTFd.plugins import bypass_csrf_protection

from ...config import DISCORD_CLIENT_SECRET
from ...models import DiscordUsers, DiscordUserActivity
Expand Down Expand Up @@ -110,12 +109,7 @@ def post_user_activity(discord_id, activity, request):
if res:
return res, code

#data = request.get_json()
try:
data = json.loads(request.get_data())
except json.JSONDecodeError:
return {"success": False, "error": f"Invalid JSON data {request.data}"}, 400

data = request.get_json()

expected_vals = ['source_user_id',
'guild_id',
Expand Down

0 comments on commit faca36a

Please sign in to comment.