<s> import json <EOL> from base64 import b64decode <EOL> from beanstalk_dispatch . execution import execute_function <EOL> from jsonview . decorators import json_view <EOL> from jsonview . exceptions import BadRequest <EOL> from django . views . decorators . csrf import csrf_exempt <EOL> from django . views . decorators . http import require_http_methods <EOL> import logging <EOL> logger = logging . getLogger ( __name__ ) <EOL> @ require_http_methods ( [ '<STR_LIT:POST>' ] ) <EOL> @ json_view <EOL> @ csrf_exempt <EOL> def dispatcher ( request ) : <EOL> function_request = json . loads ( b64decode ( request . body . decode ( ) ) . decode ( ) ) <EOL> try : <EOL> execute_function ( function_request ) <EOL> return { } <EOL> except Exception as e : <EOL> logger . error ( '<STR_LIT>' , exc_info = True ) <EOL> raise BadRequest ( e ) </s>
