@classmethod
    def _get_task_data(cls, slug):

        game = _get_game(slug)

        user = _get_user_name()

        try:
            data = _json_decoder.decode(request.POST['data'])
        except KeyError:
            raise BadRequest('Missing parameter "data"')
        except JSONDecodeError as e:
            raise BadRequest('Data-parameter JSON error: %s' % str(e))

        if not isinstance(data, dict):
            raise BadRequest('Data-parameter is not a dict')

        # pylint: disable=E1103
        get_data = data.get
        # pylint: enable=E1103

        key = get_data('key')
        if not key:
            raise BadRequest('No notification-key given')
        ## check that the key actually exists on the game
        if key not in GameNotificationKeysList.get(game).to_dict():
            raise BadRequest('Unknown key "' + key + '" given.')

        msg = get_data('msg')
        if not msg:
            raise BadRequest('No message given')

        if not msg.get('text'):
            raise BadRequest('No text-attribute in msg')

        try:
            delay = int(get_data('time') or 0)
        except ValueError:
            raise BadRequest('Incorrect format for time')

        ## filter out empty strings and if there's just nothing there, use the current user as default recipient
        recipient = get_data('recipient', '').strip() or user

        return create_id(), key, user, recipient, msg, game, delay
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/controllers/apiv1/gamenotifications.py/GamenotificationsController._get_task_data/original