How to use the neo4j.exceptions.AuthError 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
# 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,