@require_POST
def process_post_receive_hook(request, *args, **kwargs):
    """Closes review requests as submitted automatically after a push."""
    try:
        server_url = get_server_url(request=request)

        # Check if it's a git or an SVN repository and close accordingly.
        if 'payload' in request.POST:
            payload = json.loads(request.POST['payload'])
            close_git_review_requests(payload, server_url)
        else:
            payload = json.loads(request.POST['commit'])
            close_svn_review_request(payload, server_url)

    except KeyError as e:
        logging.error('There is no JSON payload in the POST request.: %s', e)
        return HttpResponse(status=415)

    except ValueError as e:
        logging.error('The payload is not in JSON format: %s', e)
        return HttpResponse(status=415)

    return HttpResponse()
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/beanstalk.py/process_post_receive_hook/original