Skip to content

Getting the driver up-to-date #377

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
Aug 18, 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
2 changes: 1 addition & 1 deletion arango/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def endpoints(self) -> Result[List[str]]:

:return: List of endpoints.
:rtype: [str]
:raise arango.exceptions.ServerEndpointsError: If retrieval fails.
:raise arango.exceptions.ClusterEndpointsError: If retrieval fails.
"""
request = Request(method="get", endpoint="/_api/cluster/endpoints")

Expand Down
23 changes: 22 additions & 1 deletion arango/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
PermissionResetError,
PermissionUpdateError,
ServerAvailableOptionsGetError,
ServerCheckAvailabilityError,
ServerCurrentOptionsGetError,
ServerDetailsError,
ServerEchoError,
Expand Down Expand Up @@ -445,7 +446,7 @@ def set_license(self, license: str, force: bool = False) -> Result[Json]:
:type force: bool
:return: Server license.
:rtype: dict
:raise arango.exceptions.ServerLicenseError: If retrieval fails.
:raise arango.exceptions.ServerLicenseSetError: If retrieval fails.
"""
request = Request(
method="put",
Expand Down Expand Up @@ -481,6 +482,25 @@ def response_handler(resp: Response) -> Json:

return self._execute(request, response_handler)

def check_availability(self) -> Result[str]:
"""Return ArangoDB server availability mode.

:return: Server availability mode ("readonly" or "default").
:rtype: str
:raise arango.exceptions.ServerCheckAvailabilityError: If retrieval fails.
"""
request = Request(
method="get",
endpoint="/_admin/server/availability",
)

def response_handler(resp: Response) -> str:
if not resp.is_success:
raise ServerCheckAvailabilityError(resp, request)
return str(resp.body["mode"])

return self._execute(request, response_handler)

def compact(
self,
change_level: Optional[bool] = None,
Expand Down Expand Up @@ -1069,6 +1089,7 @@ def metrics(self) -> Result[str]:

:return: Server metrics in Prometheus format.
:rtype: str
:raise arango.exceptions.ServerMetricsError: If operation fails.
"""
request = Request(method="get", endpoint="/_admin/metrics/v2")

Expand Down
4 changes: 4 additions & 0 deletions arango/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,10 @@ class ServerTimeError(ArangoServerError):
"""Failed to retrieve server system time."""


class ServerCheckAvailabilityError(ArangoServerError):
"""Failed to retrieve server availability mode."""


class ServerEchoError(ArangoServerError):
"""Failed to retrieve details on last request."""

Expand Down
2 changes: 1 addition & 1 deletion arango/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def normalize_headers(
if driver_flags is not None:
for flag in driver_flags:
flags = flags + flag + ";"
driver_version = "8.2.1"
driver_version = "8.2.2"
driver_header = "python-arango/" + driver_version + " (" + flags + ")"
normalized_headers: Headers = {
"charset": "utf-8",
Expand Down
4 changes: 2 additions & 2 deletions docs/foxx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ information, refer to `ArangoDB manual`_.
foxx.readme(service_mount)
foxx.swagger(service_mount)
foxx.download(service_mount)
foxx.commit(service_mount)
foxx.commit()
foxx.scripts(service_mount)
foxx.run_script(service_mount, 'setup', [])
foxx.run_script(service_mount, 'setup', {})
foxx.run_tests(service_mount, reporter='xunit', output_format='xml')

# Delete a service.
Expand Down
6 changes: 6 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DatabaseListError,
DatabasePropertiesError,
DatabaseSupportInfoError,
ServerCheckAvailabilityError,
ServerDetailsError,
ServerEchoError,
ServerEngineError,
Expand Down Expand Up @@ -355,6 +356,11 @@ def test_database_misc_methods(client, sys_db, db, bad_db, cluster, secret, db_v
with pytest.raises(CollectionKeyGeneratorsError):
bad_db.key_generators()

with pytest.raises(ServerCheckAvailabilityError):
bad_db.check_availability()
availability = db.check_availability()
assert isinstance(availability, str)


def test_database_management(db, sys_db, bad_db):
# Test list databases
Expand Down
Loading