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)
评论列表
文章目录