Skip to content

Lift server agent string restrictions #1208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/neo4j/_async/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"AsyncBoltPool",
"AsyncNeo4jPool",
"ConnectionErrorHandler",
"check_supported_server_product",
]


Expand All @@ -39,10 +38,7 @@
_bolt5,
)
from ._bolt import AsyncBolt
from ._common import (
check_supported_server_product,
ConnectionErrorHandler,
)
from ._common import ConnectionErrorHandler
from ._pool import (
AcquisitionAuth,
AcquisitionDatabase,
Expand Down
2 changes: 0 additions & 2 deletions src/neo4j/_async/io/_bolt3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
tx_timeout_as_ms,
)
from ._common import (
check_supported_server_product,
CommitResponse,
InitResponse,
ResetResponse,
Expand Down Expand Up @@ -237,7 +236,6 @@ async def hello(self, dehydration_hooks=None, hydration_hooks=None):
)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)

def logon(self, dehydration_hooks=None, hydration_hooks=None):
"""Append a LOGON message to the outgoing queue."""
Expand Down
3 changes: 0 additions & 3 deletions src/neo4j/_async/io/_bolt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
ServerStateManager,
)
from ._common import (
check_supported_server_product,
CommitResponse,
InitResponse,
ResetResponse,
Expand Down Expand Up @@ -157,7 +156,6 @@ async def hello(self, dehydration_hooks=None, hydration_hooks=None):
)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)

def logon(self, dehydration_hooks=None, hydration_hooks=None):
"""Append a LOGON message to the outgoing queue."""
Expand Down Expand Up @@ -658,7 +656,6 @@ def on_success(metadata):
)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)


class AsyncBolt4x4(AsyncBolt4x3):
Expand Down
4 changes: 0 additions & 4 deletions src/neo4j/_async/io/_bolt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
ServerStateManager,
)
from ._common import (
check_supported_server_product,
CommitResponse,
InitResponse,
LogonResponse,
Expand Down Expand Up @@ -177,7 +176,6 @@ def on_success(metadata):
)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)

def logon(self, dehydration_hooks=None, hydration_hooks=None):
"""Append a LOGON message to the outgoing queue."""
Expand Down Expand Up @@ -652,7 +650,6 @@ def on_success(metadata):
)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)

def logon(self, dehydration_hooks=None, hydration_hooks=None):
dehydration_hooks, hydration_hooks = self._default_hydration_hooks(
Expand Down Expand Up @@ -736,7 +733,6 @@ def on_success(metadata):
self.logon(dehydration_hooks, hydration_hooks)
await self.send_all()
await self.fetch_all()
check_supported_server_product(self.server_info.agent)

def run(
self,
Expand Down
15 changes: 0 additions & 15 deletions src/neo4j/_async/io/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
Neo4jError,
ServiceUnavailable,
SessionExpired,
UnsupportedServerProduct,
)


Expand Down Expand Up @@ -331,20 +330,6 @@ class CommitResponse(Response):
pass


def check_supported_server_product(agent):
"""
Check that a server product is supported by the driver.

This is done by inspecting the server agent string.

:param agent: server agent string to check for validity

:raises UnsupportedServerProduct: if the product is not supported
"""
if not agent.startswith("Neo4j/"):
raise UnsupportedServerProduct(agent)


async def receive_into_buffer(sock, buffer, n_bytes):
end = buffer.used + n_bytes
if end > len(buffer.data):
Expand Down
6 changes: 1 addition & 5 deletions src/neo4j/_sync/io/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/neo4j/_sync/io/_bolt3.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/neo4j/_sync/io/_bolt4.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/neo4j/_sync/io/_bolt5.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions src/neo4j/_sync/io/_common.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.