def web_task(f):
    """
    Checks if the task is called through the web interface.
    Task return value should be in format {'data': ...}.
    """

    @wraps(f)
    def web_task_decorator(*args, **kwargs):
        jc = JobContext.get_current_context()
        if not isinstance(jc, WebJobContext):
            raise Exception(
                "The WebTask is not called through the web interface.")
        data = f(*args, **kwargs)
        jc.add_responder(WebTaskResponder(data))
        return data['data'] if 'data' in data else ""

    return web_task_decorator
def web_task ( f ) : @ wraps ( f ) def web_task_decorator ( * args , ** kwargs ) : jc = JobContext . get_current_context ( ) if not isinstance ( jc , WebJobContext ) : raise Exception ( "The WebTask is not called through the web interface." ) data = f ( * args , ** kwargs ) jc . add_responder ( WebTaskResponder ( data ) ) return data [ 'data' ] if 'data' in data else "" return web_task_decorator
Checks if the task is called through the web interface.
    Task return value should be in format {'data': ...}.