18 lines
320 B
Python
18 lines
320 B
Python
import json
|
|
|
|
from django.http import HttpRequest
|
|
|
|
|
|
def json_body(request: HttpRequest) -> dict:
|
|
if not request.body:
|
|
return {}
|
|
|
|
try:
|
|
return json.loads(request.body)
|
|
except json.JSONDecodeError:
|
|
return {}
|
|
|
|
|
|
def normalize_session_code(code: str) -> str:
|
|
return code.strip().upper()
|