Skip to content

Commit 453f74b

Browse files
authored
Getting the driver up-to-date (#377)
* Adding missing parts * Bumping driver version
1 parent 08a2e54 commit 453f74b

File tree

6 files changed

+36
-5
lines changed

6 files changed

+36
-5
lines changed

arango/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def endpoints(self) -> Result[List[str]]:
261261
262262
:return: List of endpoints.
263263
:rtype: [str]
264-
:raise arango.exceptions.ServerEndpointsError: If retrieval fails.
264+
:raise arango.exceptions.ClusterEndpointsError: If retrieval fails.
265265
"""
266266
request = Request(method="get", endpoint="/_api/cluster/endpoints")
267267

arango/database.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
PermissionResetError,
4646
PermissionUpdateError,
4747
ServerAvailableOptionsGetError,
48+
ServerCheckAvailabilityError,
4849
ServerCurrentOptionsGetError,
4950
ServerDetailsError,
5051
ServerEchoError,
@@ -445,7 +446,7 @@ def set_license(self, license: str, force: bool = False) -> Result[Json]:
445446
:type force: bool
446447
:return: Server license.
447448
:rtype: dict
448-
:raise arango.exceptions.ServerLicenseError: If retrieval fails.
449+
:raise arango.exceptions.ServerLicenseSetError: If retrieval fails.
449450
"""
450451
request = Request(
451452
method="put",
@@ -481,6 +482,25 @@ def response_handler(resp: Response) -> Json:
481482

482483
return self._execute(request, response_handler)
483484

485+
def check_availability(self) -> Result[str]:
486+
"""Return ArangoDB server availability mode.
487+
488+
:return: Server availability mode ("readonly" or "default").
489+
:rtype: str
490+
:raise arango.exceptions.ServerCheckAvailabilityError: If retrieval fails.
491+
"""
492+
request = Request(
493+
method="get",
494+
endpoint="/_admin/server/availability",
495+
)
496+
497+
def response_handler(resp: Response) -> str:
498+
if not resp.is_success:
499+
raise ServerCheckAvailabilityError(resp, request)
500+
return str(resp.body["mode"])
501+
502+
return self._execute(request, response_handler)
503+
484504
def compact(
485505
self,
486506
change_level: Optional[bool] = None,
@@ -1069,6 +1089,7 @@ def metrics(self) -> Result[str]:
10691089
10701090
:return: Server metrics in Prometheus format.
10711091
:rtype: str
1092+
:raise arango.exceptions.ServerMetricsError: If operation fails.
10721093
"""
10731094
request = Request(method="get", endpoint="/_admin/metrics/v2")
10741095

arango/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,10 @@ class ServerTimeError(ArangoServerError):
654654
"""Failed to retrieve server system time."""
655655

656656

657+
class ServerCheckAvailabilityError(ArangoServerError):
658+
"""Failed to retrieve server availability mode."""
659+
660+
657661
class ServerEchoError(ArangoServerError):
658662
"""Failed to retrieve details on last request."""
659663

arango/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def normalize_headers(
1212
if driver_flags is not None:
1313
for flag in driver_flags:
1414
flags = flags + flag + ";"
15-
driver_version = "8.2.1"
15+
driver_version = "8.2.2"
1616
driver_header = "python-arango/" + driver_version + " (" + flags + ")"
1717
normalized_headers: Headers = {
1818
"charset": "utf-8",

docs/foxx.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ information, refer to `ArangoDB manual`_.
8383
foxx.readme(service_mount)
8484
foxx.swagger(service_mount)
8585
foxx.download(service_mount)
86-
foxx.commit(service_mount)
86+
foxx.commit()
8787
foxx.scripts(service_mount)
88-
foxx.run_script(service_mount, 'setup', [])
88+
foxx.run_script(service_mount, 'setup', {})
8989
foxx.run_tests(service_mount, reporter='xunit', output_format='xml')
9090

9191
# Delete a service.

tests/test_database.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
DatabaseListError,
2121
DatabasePropertiesError,
2222
DatabaseSupportInfoError,
23+
ServerCheckAvailabilityError,
2324
ServerDetailsError,
2425
ServerEchoError,
2526
ServerEngineError,
@@ -355,6 +356,11 @@ def test_database_misc_methods(client, sys_db, db, bad_db, cluster, secret, db_v
355356
with pytest.raises(CollectionKeyGeneratorsError):
356357
bad_db.key_generators()
357358

359+
with pytest.raises(ServerCheckAvailabilityError):
360+
bad_db.check_availability()
361+
availability = db.check_availability()
362+
assert isinstance(availability, str)
363+
358364

359365
def test_database_management(db, sys_db, bad_db):
360366
# Test list databases

0 commit comments

Comments
 (0)