@csrf_exempt
@RequireLogin(role='admin')
def start(request):
    if request.method != "GET":
        return HttpResponse(status=405)

    from api.models import redis_wrapper
    r = redis_wrapper.init_redis()
    response_key = str(ObjectId())
    redis_wrapper.publish_to_proxy(json.dumps({
        "operation": "start",
        "param": None,
        "key": response_key,
    }))
    for i in range(0, 50):
        response = r.get(response_key)
        if response is not None:
            try:
                response = json.loads(response)
            except ValueError:
                return HttpResponse(status=500)
            if ('code' in response) and (response['code'] == 200):
                return JsonResponse({"proxyResponse": response}, status=200)
            else:
                return HttpResponse(status=500)
        else:
            time.sleep(.1)  # sleep 100ms
    return HttpResponse(status=408)
Start the proxy.
dataset/ETHPy150Open emccode/heliosburn/heliosburn/django/hbproject/api/views/proxy.py/start