views.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:EthOS-Dashboard 作者: castaway2000 项目源码 文件源码
def api(request):
    hostname = None
    json_data = None
    hash_id = None
    data = "this url receives get requests for updating the gpu info to the dashboard"
    context = {'data': data}
    if request.GET:
        # for testing purposes only
        # if request.GET['test_data']:
        #     Test.objects.update_or_create(request.GET)
        # break
        if request.GET['hash']:
            hash_id = request.GET['hash']
        if request.GET['url_style']:
            json_data = ast.literal_eval(request.GET['url_style'])
            if request.GET['hostname']:
                hostname = request.GET['hostname']
                json_data['host'] = hostname
        Miner_Info.objects.filter(host=json_data['host']).update_or_create(json_data)
    return render(request, 'home/api.html', context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号