# Path: lrs/utils/req_validate.py
# def check_for_existing_statementId(stmtID):
# def check_for_no_other_params_supplied(query_dict):
# def validate_oauth_for_documents(req_dict, endpoint): 
# def validate_void_statement(void_id):
# def validate_body(body, auth, content_type):
# def server_validate_statement(stmt, auth, content_type):
# def statements_post(req_dict):
# def statements_more_get(req_dict):
# def validate_statementId(req_dict):
# def statements_get(req_dict):
# def statements_put(req_dict):
# def validate_attachments(attachment_data, content_type):
# def activity_state_post(req_dict):
# def activity_state_put(req_dict):
# def activity_state_get(req_dict):
# def activity_state_delete(req_dict):
# def activity_profile_post(req_dict):
# def activity_profile_put(req_dict):
# def activity_profile_get(req_dict):
# def activity_profile_delete(req_dict):
# def activities_get(req_dict):
# def agent_profile_post(req_dict):
# def agent_profile_put(req_dict):
# def agent_profile_get(req_dict):
# def agent_profile_delete(req_dict):
# def agents_get(req_dict):
# 
# Path: lrs/utils/req_parse.py
# def parse(request, more_id=None):
# def set_cors_authorization(request, r_dict):
# def set_normal_authorization(request, r_dict):
# def parse_post_put_body(request, r_dict):
# def parse_cors_request(request, r_dict):
# def parse_normal_request(request, r_dict):
# def parse_attachment(request, r_dict):
# def validate_hash(part_hash, part):
# def parse_signature_attachments(r_dict, part_dict):
# def validate_non_signature_attachment(unsigned_stmts, sha2s, part_dict):
# def handle_signatures(stmt_tuples, sha2s, part_dict):
# def validate_signature(tup, part):
# def compare_payloads(jws_payload, body_payload, sha2_key):
# def temp_save_attachments(msg):
# def get_part_payload(part):
# def cert_to_key(cert):
# def get_endpoint(request):
# def get_headers(headers):
# 
# Path: lrs/utils/req_process.py
# def process_statement(stmt, auth, payload_sha2s):
# def process_body(stmts, auth, payload_sha2s):
# def process_complex_get(req_dict):
# def statements_post(req_dict):
# def statements_put(req_dict):
# def statements_more_get(req_dict):
# def statements_get(req_dict):
# def build_response(stmt_result, single=False):
# def activity_state_post(req_dict):
# def activity_state_put(req_dict):
# def activity_state_get(req_dict):
# def activity_state_delete(req_dict):
# def activity_profile_post(req_dict):
# def activity_profile_put(req_dict):
# def activity_profile_get(req_dict):
# def activity_profile_delete(req_dict):
# def activities_get(req_dict):
# def agent_profile_post(req_dict):
# def agent_profile_put(req_dict):
# def agent_profile_get(req_dict):
# def agent_profile_delete(req_dict):
# def agents_get(req_dict):
# 
# Path: lrs/utils/XAPIVersionHeaderMiddleware.py
# class XAPIVersionHeader(object):
#     def __init__(self, get_response):
#     def __call__(self, request):
#     def process_request(self, request):
#     def process_response(self, request, response):
# 
# Path: lrs/utils/XAPIConsistentThroughMiddleware.py
# class XAPIConsistentThrough(object):
#     def __init__(self, get_response):
#     def __call__(self, request):
#     def process_request(self, request):
#     def process_response(self, request, response):


import logging
from django.conf import settings
from django.urls import reverse
from django.db import transaction
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.core.exceptions import SuspiciousOperation
from django.utils.decorators import decorator_from_middleware
from django.views.decorators.http import require_http_methods
from .exceptions import BadRequest, Unauthorized, Forbidden, NotFound, Conflict, PreconditionFail, OauthUnauthorized, OauthBadRequest
from .utils import req_validate, req_parse, req_process, XAPIVersionHeaderMiddleware, XAPIConsistentThroughMiddleware
                    "methods": ["GET", "HEAD"],
                    "endpoint": reverse('lrs:agents'),
                    "description": "Returns a special, Person object for a specified agent.",
                },
                "agents_profile":
                {
                    "name": "Agent Profile",
                    "methods": ["PUT", "POST", "GET", "DELETE", "HEAD"],
                    "endpoint": reverse('lrs:agent_profile'),
                    "description": "Saves/retrieves/deletes the specified profile document in the context of the specified agent.",
                }
            }
        }
    }
    return JsonResponse(lrs_data)


@require_http_methods(["GET", "HEAD"])
@decorator_from_middleware(XAPIVersionHeaderMiddleware.XAPIVersionHeader)
def statements_more(request, more_id):
    return handle_request(request, more_id)


@require_http_methods(["GET", "HEAD"])
@decorator_from_middleware(XAPIVersionHeaderMiddleware.XAPIVersionHeader)
def statements_more_placeholder(request):
    return HttpResponseForbidden("Forbidden")


@require_http_methods(["PUT", "GET", "POST", "HEAD"])

# Path: lrs/utils/req_validate.py
# def check_for_existing_statementId(stmtID):
# def check_for_no_other_params_supplied(query_dict):
# def validate_oauth_for_documents(req_dict, endpoint): 
# def validate_void_statement(void_id):
# def validate_body(body, auth, content_type):
# def server_validate_statement(stmt, auth, content_type):
# def statements_post(req_dict):
# def statements_more_get(req_dict):
# def validate_statementId(req_dict):
# def statements_get(req_dict):
# def statements_put(req_dict):
# def validate_attachments(attachment_data, content_type):
# def activity_state_post(req_dict):
# def activity_state_put(req_dict):
# def activity_state_get(req_dict):
# def activity_state_delete(req_dict):
# def activity_profile_post(req_dict):
# def activity_profile_put(req_dict):
# def activity_profile_get(req_dict):
# def activity_profile_delete(req_dict):
# def activities_get(req_dict):
# def agent_profile_post(req_dict):
# def agent_profile_put(req_dict):
# def agent_profile_get(req_dict):
# def agent_profile_delete(req_dict):
# def agents_get(req_dict):
# 
# Path: lrs/utils/req_parse.py
# def parse(request, more_id=None):
# def set_cors_authorization(request, r_dict):
# def set_normal_authorization(request, r_dict):
# def parse_post_put_body(request, r_dict):
# def parse_cors_request(request, r_dict):
# def parse_normal_request(request, r_dict):
# def parse_attachment(request, r_dict):
# def validate_hash(part_hash, part):
# def parse_signature_attachments(r_dict, part_dict):
# def validate_non_signature_attachment(unsigned_stmts, sha2s, part_dict):
# def handle_signatures(stmt_tuples, sha2s, part_dict):
# def validate_signature(tup, part):
# def compare_payloads(jws_payload, body_payload, sha2_key):
# def temp_save_attachments(msg):
# def get_part_payload(part):
# def cert_to_key(cert):
# def get_endpoint(request):
# def get_headers(headers):
# 
# Path: lrs/utils/req_process.py
# def process_statement(stmt, auth, payload_sha2s):
# def process_body(stmts, auth, payload_sha2s):
# def process_complex_get(req_dict):
# def statements_post(req_dict):
# def statements_put(req_dict):
# def statements_more_get(req_dict):
# def statements_get(req_dict):
# def build_response(stmt_result, single=False):
# def activity_state_post(req_dict):
# def activity_state_put(req_dict):
# def activity_state_get(req_dict):
# def activity_state_delete(req_dict):
# def activity_profile_post(req_dict):
# def activity_profile_put(req_dict):
# def activity_profile_get(req_dict):
# def activity_profile_delete(req_dict):
# def activities_get(req_dict):
# def agent_profile_post(req_dict):
# def agent_profile_put(req_dict):
# def agent_profile_get(req_dict):
# def agent_profile_delete(req_dict):
# def agents_get(req_dict):
# 
# Path: lrs/utils/XAPIVersionHeaderMiddleware.py
# class XAPIVersionHeader(object):
#     def __init__(self, get_response):
#     def __call__(self, request):
#     def process_request(self, request):
#     def process_response(self, request, response):
# 
# Path: lrs/utils/XAPIConsistentThroughMiddleware.py
# class XAPIConsistentThrough(object):
#     def __init__(self, get_response):
#     def __call__(self, request):
#     def process_request(self, request):
#     def process_response(self, request, response):


# Path: lrs/views.py
import logging
from django.conf import settings
from django.urls import reverse
from django.db import transaction
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.core.exceptions import SuspiciousOperation
from django.utils.decorators import decorator_from_middleware
from django.views.decorators.http import require_http_methods
from .exceptions import BadRequest, Unauthorized, Forbidden, NotFound, Conflict, PreconditionFail, OauthUnauthorized, OauthBadRequest
from .utils import req_validate, req_parse, req_process, XAPIVersionHeaderMiddleware, XAPIConsistentThroughMiddleware

                    "methods": ["GET", "HEAD"],
                    "endpoint": reverse('lrs:agents'),
                    "description": "Returns a special, Person object for a specified agent.",
                },
                "agents_profile":
                {
                    "name": "Agent Profile",
                    "methods": ["PUT", "POST", "GET", "DELETE", "HEAD"],
                    "endpoint": reverse('lrs:agent_profile'),
                    "description": "Saves/retrieves/deletes the specified profile document in the context of the specified agent.",
                }
            }
        }
    }
    return JsonResponse(lrs_data)


@require_http_methods(["GET", "HEAD"])
@decorator_from_middleware(XAPIVersionHeaderMiddleware.XAPIVersionHeader)
def statements_more(request, more_id):
    return handle_request(request, more_id)


@require_http_methods(["GET", "HEAD"])
@decorator_from_middleware(XAPIVersionHeaderMiddleware.XAPIVersionHeader)
def statements_more_placeholder(request):
    return HttpResponseForbidden("Forbidden")


@require_http_methods(["PUT", "GET", "POST", "HEAD"])

@decorator_from_middleware(XAPIConsistentThroughMiddleware.XAPIConsistentThrough)