I have a function getCode that is called from ajax and returns HttpResponse(json.dumps({'code': 2})). I have one case where this function is called from inside another Python function in an effort to stick to DRY. I am trying to access the HttpResponse in an if statement in this other function like so:
x = getCode(request)
if x['code'] == 2:
# do stuff
How do I parse the HttpResponse object in Python so that I can access the data within as a dict?