How to use the neo4j.exceptions.Forbidden function in neo4j

To help you get started, we’ve selected a few neo4j examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github technige / py2neo / py2neo / internal / http.py View on Github external
def raise_error(self, status_code, data):
        if status_code == UNAUTHORIZED:
            raise AuthError(self.uri)
        if status_code == FORBIDDEN:
            raise Forbidden(self.uri)
        if data:
            content = json_loads(data.decode('utf-8'))
        else:
            content = {}
        message = content.pop("message", "HTTP request to <%s> returned unexpected status code %s" % (self.uri, status_code))
        error = GraphError(message, **content)
        error.http_status_code = status_code
        raise error
github technige / py2neo / py2neo / status.py View on Github external
"Neo.ClientError.Statement.ConstraintVerificationFailed": ConstraintError,
    "Neo.ClientError.Statement.ConstraintViolation": ConstraintError,

    # CypherSyntaxError
    "Neo.ClientError.Statement.InvalidSyntax": CypherSyntaxError,
    "Neo.ClientError.Statement.SyntaxError": CypherSyntaxError,

    # CypherTypeError
    "Neo.ClientError.Procedure.TypeError": CypherTypeError,
    "Neo.ClientError.Statement.InvalidType": CypherTypeError,
    "Neo.ClientError.Statement.TypeError": CypherTypeError,

    # Forbidden
    "Neo.ClientError.General.ForbiddenOnReadOnlyDatabase": Forbidden,
    "Neo.ClientError.General.ReadOnly": Forbidden,
    "Neo.ClientError.Schema.ForbiddenOnConstraintIndex": Forbidden,
    "Neo.ClientError.Schema.IndexBelongsToConstrain": Forbidden,
    "Neo.ClientError.Security.Forbidden": Forbidden,
    "Neo.ClientError.Transaction.ForbiddenDueToTransactionType": Forbidden,

    # Unauthorized
    "Neo.ClientError.Security.AuthorizationFailed": AuthError,
    "Neo.ClientError.Security.Unauthorized": AuthError,