Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created May 4, 2020 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrightnBubbly/72f9b1b9a28820e9d1c20cce77bc39c0 to your computer and use it in GitHub Desktop.
Save BrightnBubbly/72f9b1b9a28820e9d1c20cce77bc39c0 to your computer and use it in GitHub Desktop.
@csrf_exempt
def init(request):
if not request.body:
return JsonResponse(status=200, data={'message': 'No request body'})
body = json.loads(bytes(request.body).decode('utf-8'))
if 'username' not in body:
return JsonResponse(status=400, data={'message': 'Username is required to join the channel'})
username = body['username']
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment