import os
import hashlib
import simplejson as json
from flask import request
from flask.ext.restful import abort
from irianas_client.api import path_file_token


def require_token(f):
    def inner(*args, **kwargs):
        if os.path.exists(path_file_token):
            file_token = open(path_file_token)
            data_json = json.loads(file_token)

            token = hashlib.sha512(request.form.data['token']).hexdigest()
            ip = hashlib.sha512(request.form.data['ip']).hexdigest()

            if data_json.get('token') == token and \
               data_json.get('ip') == ip:
                return f(*args, **kwargs)
            else:
                return abort(401)
        else:
            return abort(401)
    return inner

import os
import hashlib
import simplejson as json
from flask import request
from flask.ext.restful import abort
from irianas_client.api.api_task_basic import path_file_token


def require_token(f):
    def inner(*args, **kwargs):
        if os.path.exists(path_file_token):
            file_token = open(path_file_token)
            data_json = json.loads(file_token)

            token = hashlib.sha512(request.form.data['token']).hexdigest()
            ip = hashlib.sha512(request.form.data['ip']).hexdigest()

            if data_json.get('token') == token and \
               data_json.get('ip') == ip:
                return f(*args, **kwargs)
            else:
                return abort(401)
        else:
            return abort(401)
    return inner

Fix require flask-restful