def authenticated(func):
        def _authenticate(self, request):
            session = request.getSession()
            if session not in self.authenticated_sessions:
                session.expire()
                request.setResponseCode(401)
                request.write('<html><body><div><span style="color:red">Authorization Error</span></div>'
                              '<h2>Permission Denied</h2></body></html>')
                request.finish()
                return server.NOT_DONE_YET
            else:
                if request.getHeader("Content-Type") == "application/json":
                    request.args = json.loads(request.content.read())
                func(self, request)
                return server.NOT_DONE_YET
        return wraps(func)(_authenticate)
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/api/restapi.py/OpenBazaarAPI.authenticated/original