当前位置: 首页>>代码示例>>Python>>正文


Python public.success_result_http函数代码示例

本文整理汇总了Python中public.success_result_http函数的典型用法代码示例。如果您正苦于以下问题:Python success_result_http函数的具体用法?Python success_result_http怎么用?Python success_result_http使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了success_result_http函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: jenkins_info

def jenkins_info(request):
    """
    :author: yechengzhou
    :param request:
    :return:
    """
    if request.method != "GET":
        return  public.fail_result_http(u'该接口只支持GET')
    if 'name' in request.REQUEST:
        if 'job' in request.REQUEST:
            logging.debug('')
            job = utils.JenkinsInfo(name=request.REQUEST['name'], job=request.REQUEST['job'])
            if job.get_status():
                return public.success_result_http(json.dumps(job.get_ret()))
            else:
                return public.fail_result_http(u'get jenkins info failed')
        else:
            view = utils.JenkinsInfo(name=request.REQUEST['name'])
            if view.get_status():
                return public.success_result_http(json.dumps(view.get_ret()))
            else:
                return public.fail_result_http(u'get jenkins info failed')

    else:
        return public.fail_result_http(u"wrong argument")
开发者ID:ghmjava,项目名称:web_site,代码行数:25,代码来源:views.py

示例2: get_seal_version

def get_seal_version(request):
    module = request.GET.get('module')
    if module == 'biz':
        return public.success_result_http(data_utils.get_seal_or_newlab_version('biz'))
    elif module == "shanghaife":
        return public.success_result_http(data_utils.get_seal_or_newlab_version('shanghaife'))
    else:
        return public.success_result_http({'biz': data_utils.get_seal_or_newlab_version('biz'), "shanghaife": data_utils.get_seal_or_newlab_version('biz')})
开发者ID:ghmjava,项目名称:web_site,代码行数:8,代码来源:views.py

示例3: set_algo_view

def set_algo_view(request):
    if request.method != "POST":
        return public.fail_result_http(u"POST only")

    data = json.loads(request.body)
    x = data.get("x")
    y = data.get("y")
    module = data.get("module_id")
    scene = data.get("scene_id")
    resource_name = data.get("resource")
    if len(utils.get_resource_by_name(resource_name)):
        resource_id = utils.get_resource_by_name(resource_name).get('id')
    else:
        print 'get resource id failed'

    record_id = data.get("id")
    if not (x and y and module and scene):
        return public.fail_result_http(u"module, scence, X, Y should not be NONE")

    ret = algo.set_algo_info(module, scene , resource_name, x, y)

    # save formula info
    tmp = {}
    tmp['a'] = ret.get('a')
    tmp['b'] = ret.get('b')

    this_formula = {}
    this_formula['resource_id'] = resource_id if resource_id else 0
    this_formula['record_id'] = record_id
    this_formula['formula'] = json.dumps(tmp)
    utils.save_formula(this_formula)

    if type(ret) == type(""):
        return public.fail_result_http(ret)
    return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:35,代码来源:view_algo.py

示例4: get_branch_svn_log

def get_branch_svn_log(request):
    """
    :author: yechengzhou
    :param request: request should contains branch name and module name
    :return: json format branch svn log
    """
    if request.method != "GET":
        return public.fail_result_http(u"该接口只支持GET")
    else:

        module = request.GET.get('module')
        branch = request.GET.get('branch')
        type = request.GET.get('type') # 0 -- one day  1 -- last 10

        if not (module and branch):
            return public.fail_result_http(u"参数错误")

        else:
            if type == '0' or type == None:
                if branch != "trunk":
                    start = branch.split('_')[-2]
                    start_time = public.str2datetime(start, "%Y%m%d")
                    end_time = start_time + datetime.timedelta(days=1)
                    end = public.datetime2str(end_time, "%Y%m%d")
                    ret = utils.get_branch_svn_log(module,branch, start, end)
                else:
                    ret = utils.get_branch_svn_log(module,branch)


            elif type == '1':
                ret = utils.get_branch_svn_log(module,branch )


            return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:34,代码来源:views.py

示例5: static_dashboard_view

def static_dashboard_view(request):
    env = request.GET.get("env")
    if env.upper() == public.ENV_MOB:
        ret = utils.static_mob()
    else:
        ret = utils.static_newlab()
    return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:7,代码来源:views.py

示例6: filter_api_view

def filter_api_view(request):
    q = request.GET.get("q")
    data = utils.filter_api(q)
    if data:
        return public.success_result_http(data)
    else:
        return public.fail_result_http(data)
开发者ID:sdgdsffdsfff,项目名称:api,代码行数:7,代码来源:views.py

示例7: update_api_mob_version_view

def update_api_mob_version_view(request):
    if request.method == "POST":
        data = json.loads(request.body)
        ret = utils.update_api_mob_version(data)
        return public.success_result_http(ret)
    else:
        return public.fail_result_http("Only Post!")
开发者ID:sdgdsffdsfff,项目名称:api,代码行数:7,代码来源:views.py

示例8: copy_api_view

def copy_api_view(request):
    data = {}
    pk = request.GET.get("id")
    user = request.session.get("django_mail")
    flag = request.GET.get("flag")
    ret = utils.copy_api(pk, user, flag)
    return public.success_result_http(ret)
开发者ID:sdgdsffdsfff,项目名称:api,代码行数:7,代码来源:views.py

示例9: get_sealed_or_newlab_version

def get_sealed_or_newlab_version(request):
    # 获取封板号 封板号没有就返回newlab版本
    if request.method != "GET":
        return public.fail_result_http(u"Only support GET")
    else:
        ret = utils.get_seal_or_newlab_version(request.REQUEST.get("module"))
        return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:7,代码来源:views.py

示例10: get_build_status

def get_build_status(request):
    if request.method != "GET":
        return public.fail_result_http(u"do not accept get method")
    else:
        job_name = request.REQUEST.get('name')
        view = request.REQUEST.get('view')


        # build = request.REQUEST.get('build')

        # 目前只有newlab
        if job_name and job_name != 'undefined' and not job_name.startswith("newlabs"):
            job_name = "newlabs_" + job_name
        else:
            return public.fail_result_http('get job name failed')

        view = "agile"
        JB = utils.JenkinsInfo(view, job_name)
        build = JB.get_ret()['builds'][0]['number']

        JI = utils.JenkinsInfo(view, job_name, str(build))
        if JI.get_status():
            if_building = JI.get_ret()['building']
            if JI.get_ret()['result']:
                job_status = JI.get_ret()['result'].lower()
            else:
                job_status = 'fail'
            return public.success_result_http({"status":job_status, 'building': if_building})
        else:
            logging.error("Get Job Info Failed:" + str(request))
            return public.fail_result_http('get job info failed')
开发者ID:ghmjava,项目名称:web_site,代码行数:31,代码来源:views.py

示例11: save_single_api_record

def save_single_api_record(request):
    id = utils.save_api_record(json.loads(request.body))
    public_info = utils.get_public(request)
    if public_info.get('auth').get('write') != 1:
        return public.fail_result_http('have no write right')
    else:
        return public.success_result_http({'id': id})
开发者ID:ghmjava,项目名称:web_site,代码行数:7,代码来源:view_algo.py

示例12: bind_job_view

def bind_job_view(request):
    if request.method != "POST":
        return public.fail_result_http(u"Only support POST!")
    else:
        data = json.loads(request.body)
        ret = utils.bind_job(data)
        return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:7,代码来源:views.py

示例13: interface_show_api_view

def interface_show_api_view(request):
    data = data_utils.get_api(request.GET.get("id"))
    urlHost = data_utils.get_url_host_list()
    url_id = data.get("url")
    for url in urlHost:
        if url_id == url.get("id"):
            data["url"] = url.get("host")
    return public.success_result_http(data)
开发者ID:sdgdsffdsfff,项目名称:api,代码行数:8,代码来源:views.py

示例14: bind_api_tag_view

def bind_api_tag_view(request):
    if request.method == "POST":
        data = json.loads(request.body)
        data["user"] = public.get_user_mail(request)
        utils.bind_api_tag(data)
        return public.success_result_http()
    else:
        return public.fail_result_http("Only Post!")
开发者ID:sdgdsffdsfff,项目名称:api,代码行数:8,代码来源:views.py

示例15: set_auth_view

def set_auth_view(request):
    if request.method != "POST":
        return public.fail_result_http(u"Only support POST!")
    else:
        ret = utils.set_auth(request)
        if ret:
            return public.fail_result_http(ret)
        return public.success_result_http(ret)
开发者ID:ghmjava,项目名称:web_site,代码行数:8,代码来源:views.py


注:本文中的public.success_result_http函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。