def get_graph_values(request, equipment_name, module_name): """ This will return the graph data for the selected module :return: Json Response """ try: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: if equipment_name == COKE_DRUM_VALUE and module_name == PDI_VALUE: return JsonResponse(pdi_graph.get_pdi_graph(request, equipment_name, module_name), safe=False) if equipment_name == FURNACE_VALUE and (module_name == PASS_A_VALUE or module_name == PASS_B_VALUE): return JsonResponse(furnace_graph.get_furnace_graph(request, equipment_name, module_name), safe=False) if equipment_name == FURNACE_VALUE and (module_name == SPALL_PASS_A_VALUE or module_name == SPALL_PASS_B_VALUE): return JsonResponse(furnace_spall_graph.get_furnace_spall_graph(request, equipment_name, module_name), safe=False) if equipment_name == COKE_DRUM_VALUE and module_name == OUTAGE_VALUE: return JsonResponse(outage_graph.get_outage_graph(request, equipment_name, module_name), safe=False) if equipment_name == COKE_DRUM_VALUE and module_name == HGI_VALUE: return JsonResponse(hgi_graph.get_hgi_graph(request, equipment_name, module_name), safe=False) else: return JsonResponse("This equipment is not registered with us!", safe=False) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED)
def update_user(request): """ This function will update the existing user :param request: request django object :return: jsonobject """ obj = None try: if request.method == PUT_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin', 'Admin'] if r_name in names: if loggedin_user_details: request_payload = _RequestValidation().validate_request( request, [ USERID_KEY, NAME, LOGIN_ID, USEREMAIL_KEY, DESIGNATION, USER_TYPE, EAMIL_NOTIFICATION ]) obj = UpdateUser(loggedin_user_details, request_payload) return obj.update_user() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "update_users_data API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def get_revenue_graph(request, equipment_name=None, module_name=None): """ This function will return the revenue loss data for the overhead pdi module :param module_name: module name :param equipment_name: equipment name :param request: request django object :return: json response """ query_params, obj = None, None try: query_params = { TAG_NAME_REQUEST: request.GET[TAG_NAME_REQUEST], START_DATE_REQUEST: request.GET[START_DATE_REQUEST], END_DATE_REQUEST: request.GET[END_DATE_REQUEST] } except: pass try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = RevenueGraph(query_params, equipment_name, module_name) return obj.get_values() log_debug(METHOD_NOT_ALLOWED) return JsonResponse({MESSAGE_KEY: METHOD_NOT_ALLOWED}, status=HTTP_405_METHOD_NOT_ALLOWED) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj
def get_logout_user(self): try: token = self._request_payload[TOKEN] role = jwt.decode(token, verify=False) obj = HashingSalting() if role['role'] == 'Admin': obj.decreasing_admin_login_count() if role['role'] == 'Non Admin': obj.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': obj.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Logout Successfully"}) except Exception as e: log_error(e)
def get_outage_multiline(request, equipment_name=None, module_name=None): """ This function will return the outage multiline graph data :param module_name: module name :param equipment_name: equipment name :param request: request django object :return: json response """ query_params, obj = None, None try: query_params = request except: pass try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = OutageMultiLine(query_params, equipment_name, module_name) return obj.get_values() log_debug(METHOD_NOT_ALLOWED) return JsonResponse({MESSAGE_KEY: METHOD_NOT_ALLOWED}, status=HTTP_405_METHOD_NOT_ALLOWED) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_outage_multi_line_graph_data API : " + str( error_instance(e)) return excMsg finally: if obj: del obj
def download_algorithm_file(request, algorithm_name): """ This function will download csv, xml files and will return error if generated. :param request: request django object :param algorithm_name : this will have the algorithm name :return: json response """ query_params = obj = None try: query_params = {FILES_NAME_REQUEST: request.GET[FILES_NAME_REQUEST]} except: pass try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) permissions = loggedin_user_details['permissions']['Settings'] permission_name = 'Upload/Download Configuration Files' if permission_name in permissions: if loggedin_user_details: obj = DownloadAlgorithmFile(algorithm_name, query_params) return obj.download_file() else: return JsonResponse({MESSAGE_KEY: "Forbidden Error"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj
def get_algorithm_list(request, algorithm_name=None): """ This function will return the algorithm list and will return error if generated. :param request: request django object :param algorithm_name : this either can be none or else it will have the algorithm name :return: json response """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin'] if r_name in names: if loggedin_user_details: obj = AllAlgorithmList() if algorithm_name: return obj.get_file_data_by_algorithm_name( algorithm_name) else: return obj.get_algorithms_details() else: return JsonResponse({MESSAGE_KEY: "Forbidden Error"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_access_list API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def update_access_configuration(request): """ This function will update the Access of users details with the passed json values. :param request: request django object :return: json response """ obj = None try: if request.method == PUT_REQUEST: request_payload = json.loads(request.body.decode(UTF8_FORMAT)) loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin'] if r_name in names: if loggedin_user_details: request_payload = _RequestValidation().validate_request( request, request_payload) obj = AccessUpdate(request_payload) return obj.update_access() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "Access_Update API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def download_notifications_data(request): """ This function will download the notifications from the database :param request: request django object :return: json response """ query_params, obj = None, None try: query_params = request except: pass try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = Notifications(loggedin_user_details, query_params) return obj.get_notifications(request) else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_notifications API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def update_algorithm_params(request): """ This function will update the algorithm with the passed json values. :param request: request django object :param algorithm_name : this either can be none or else it will have the algorithm name :return: json response """ obj = None try: if request.method == PUT_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) permissions = loggedin_user_details['permissions']['Settings'] permission_name = 'Module On/OFF' if permission_name in permissions: if loggedin_user_details: request_payload = json.loads( request.body.decode(UTF8_FORMAT)) obj = UpdateAlgorithmParams(request_payload) return obj.update_algorithms() else: return JsonResponse({MESSAGE_KEY: "Forbidden Error"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj
def get_user_data(request): """ This function will get the values for the equipment level as well as console level dynamic benchmarking :param request: request django object :param unit: unit name :param console: console name will be provided :param equipment: equipment name will be provided :return: json response """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin'] if r_name in names: if loggedin_user_details: obj = user_get() return obj.get_user_values() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_all_users_data API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def delete_user(request, login_id=None): """ This function will delete the existing user :param login_id: it will give the log_in id of the deleting user :param request: request django object :param username : username that need to be deleted :return: json object """ obj = None try: if request.method == DELETE_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin'] if r_name in names: if loggedin_user_details: obj = DeleteUser(loggedin_user_details, login_id) return obj.delete_user() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "delete_users_data API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def get_benchmarking_graph(request): """ This function will return the graph data for the selected module :param request: request django object :return: json response """ query_params, obj = None, None try: query_params = request except: pass try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = BenchMarkingGraph(query_params) return obj.get_benchmark_graph() log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "benchmarking_graph API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def upload_algorithm_file(request, algorithm_name): """ This function will upload csv and xml files, file name and description and will return error if generated. :param request: request django object :param algorithm_name : this will have the algorithm name :return: json response """ obj = None try: if request.method == POST_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = UploadAlgorithmFile(request.FILES.getlist('files'), algorithm_name, request.POST.get('description'), request.POST.get('file_names')) return obj.upload_file() log_debug(METHOD_NOT_ALLOWED) return JsonResponse({MESSAGE_KEY: METHOD_NOT_ALLOWED}, status=HTTP_405_METHOD_NOT_ALLOWED) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj
def clear_notifications_data(request): """ This function will get the values for dynamic benchmarking :param request: request django object :return: json response """ obj = None try: if request.method == POST_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: request_payload = json.loads(request.body.decode(UTF8_FORMAT)) obj = ClearNotifications(loggedin_user_details, request_payload) return obj.clear_notifications() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "clear_notifications API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def get_configscreen_data(request): print("hi") """ This function will get the values for the equipment level as well as console level dynamic benchmarking :param request: request django object :param unit: unit name :param console: console name will be provided :param equipment: equipment name will be provided :return: json response """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = ConfigScreen() return obj.get_values() log_debug(METHOD_NOT_ALLOWED) return JsonResponse({MESSAGE_KEY: METHOD_NOT_ALLOWED}, status=HTTP_405_METHOD_NOT_ALLOWED) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj
def get_user_list(request): """ This function will help to get all the users :param request: request django object :param username : for particular username :return: json object """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) r_name = loggedin_user_details['role'] names = ['Super Admin', 'Admin'] if r_name in names: if loggedin_user_details: obj = GetUSerData(loggedin_user_details) return obj.getuser_list() else: return JsonResponse({MESSAGE_KEY: "FORBIDDEN ERROR"}, status=HTTP_403_FORBIDDEN) log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "user_list API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def get_hgi_overview(request, equipment_name=None, module_name=None): """ This function will return the hgi module level overview :param module_name: module name :param equipment_name: equipment name :param request: request django object :return: json response """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = HgiOverview(equipment_name, module_name) return obj.get_hgi_data() log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_hgi_overview API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def update_hgi_target(request, algorithm_name): """ This function will update the target with the passed json values. :param request: request django object :param algorithm_name : this either can be none or else it will have the target name :return: json response """ obj = None try: if request.method == PUT_REQUEST: request_payload = json.loads(request.body.decode(UTF8_FORMAT)) loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = HgiTargetUpdateParams(request_payload, algorithm_name) return obj.update_targets() log_debug(METHOD_NOT_ALLOWED) return json_MethodNotAllowed except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: excMsg = "get_hgi_list API : " + str(error_instance(e)) return excMsg finally: if obj: del obj
def get_equipment_names(request): """ This function will return the names for all the equipment and module :param request: request django object :return: json response """ obj = None try: if request.method == GET_REQUEST: loggedin_user_details = _TokenValidation.validate_token(request) if loggedin_user_details: obj = EquipmentNames(loggedin_user_details) return obj.get_names_values() log_debug(METHOD_NOT_ALLOWED) return JsonResponse({MESSAGE_KEY: METHOD_NOT_ALLOWED}, status=HTTP_405_METHOD_NOT_ALLOWED) except jwt.ExpiredSignatureError: token = request.META[HTTP_AUTHORIZATION_TOKEN].split(" ")[1] role = jwt.decode(token, verify=False) ob = HashingSalting() if role['role'] == 'Admin': ob.decreasing_admin_login_count() if role['role'] == 'Non Admin': ob.decreasing_Non_Admin_login_count() if role['role'] == 'Super Admin': ob.decreasing_super_Admin_login_count() return JsonResponse({MESSAGE_KEY: "Token Expired"}, status=HTTP_401_UNAUTHORIZED) except Exception as e: return error_instance(e) finally: if obj: del obj