def get(self, request): print 'Update comments' user_id = utils.check_session_variable(request) ip = utils.getip() alldata = request.POST api_key = request.META.get('HTTP_AUTHORIZATION') if user_id is not None or api_key == settings.API_KEY: try: print 'settings.VBO_SERVER == ', settings.VBO_SERVER results = requests.get(settings.VBO_SERVER + 'update-callouts/?' + '&report_num=' + request.GET.get('report_num') \ + '&report_name=' + request.GET.get('report_name') + '&report_run_date='+ request.GET.get('report_run_date') \ + '&report_callouts='+ request.GET.get('report_callouts') ) return JsonResponse({ 'status': 'success', 'results': [results.json()] }) except Exception as e: print 'update callouts == ', e logger.debug( "ReportData VBO-Module Exception == {0}".format(e)) return JsonResponse({'status': 'Contact Support Team'}) return JsonResponse({'status': 'success'}) else: return JsonResponse({'status': 'session timeout'})
def post(self, request): user_id = utils.check_session_variable(request) # print ' report_num == ', request.GET.get('report_callouts') ip = utils.getip() alldata = request.body print 'alldata == ', alldata try: print 'alldata == ', json.loads(request.body) except Exception as e: print 'e == ', e # payload = dict(six.iterlists(json.loads(request.body))) # payload = json.dumps(json.loads(request.body)) # alldata = request.POST payload = request.body # payload = dict(six.iterlists(request.POST)) if user_id is not None or api_key == settings.API_KEY: try: results = requests.post(settings.VBO_SERVER + 'store-callouts/?' + '&report_num=' + request.GET.get('report_num') \ + '&report_id=' + request.GET.get('report_id') + '&report_run_date='+ request.GET.get('report_run_date'), data=payload ) # print 'results.json == ', results.json() print 'results.json == ', results.json() return JsonResponse({ 'status': 'success', 'results': [results.json()] }) except Exception as e: print 'update callouts == ', e logger.debug( "ReportData VBO-Module Exception == {0}".format(e)) return JsonResponse({'status': 'Contact Support Team'}) return JsonResponse({'status': 'success'}) else: return JsonResponse({'status': 'session timeout'})
def post(self, request): print 'im here ' ip = utils.getip() username = request.POST['username'] password = request.POST['password'] result = utils.check_user_auth(request.POST['username'],request.POST['password']) if result['status'] == 'success': request.session['userid'] = request.POST['username'] return render(request,'qvfb/qvfb_landing_page.html',{'error':'N'}) else: return utils.page_redirects_login(request,user_id)
def post(self, request): user_id = utils.check_session_variable(request) ip = utils.getip() alldata = request.POST api_key = request.META.get('HTTP_AUTHORIZATION') if user_id is not None or api_key == settings.API_KEY: try: # results = requests.get('http://localhost:9000/get-report-names') results = requests.get(settings.VBO_SERVER + 'get-nbrf-data') return JsonResponse({ 'status': 'success', 'results': [results.json()] }) except Exception as e: print 'Exception == ', e logger.debug("ReportData VBO-Module == {0}".format(e)) return JsonResponse({'status': 'Contact Support Team'}) return JsonResponse({'status': 'success'}) else: return JsonResponse({'status': 'session timeout'})