python-arango 7.9.1__tar.gz → 8.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. {python-arango-7.9.1 → python_arango-8.0.0}/.circleci/config.yml +1 -1
  2. {python-arango-7.9.1 → python_arango-8.0.0}/PKG-INFO +19 -18
  3. {python-arango-7.9.1 → python_arango-8.0.0}/README.md +16 -15
  4. {python-arango-7.9.1 → python_arango-8.0.0}/arango/client.py +28 -7
  5. {python-arango-7.9.1 → python_arango-8.0.0}/arango/cluster.py +74 -0
  6. {python-arango-7.9.1 → python_arango-8.0.0}/arango/collection.py +115 -23
  7. {python-arango-7.9.1 → python_arango-8.0.0}/arango/connection.py +49 -4
  8. {python-arango-7.9.1 → python_arango-8.0.0}/arango/database.py +295 -10
  9. {python-arango-7.9.1 → python_arango-8.0.0}/arango/exceptions.py +47 -3
  10. {python-arango-7.9.1 → python_arango-8.0.0}/arango/executor.py +26 -11
  11. {python-arango-7.9.1 → python_arango-8.0.0}/arango/formatter.py +15 -1
  12. {python-arango-7.9.1 → python_arango-8.0.0}/arango/graph.py +9 -0
  13. {python-arango-7.9.1 → python_arango-8.0.0}/arango/http.py +84 -5
  14. {python-arango-7.9.1 → python_arango-8.0.0}/arango/replication.py +9 -7
  15. {python-arango-7.9.1 → python_arango-8.0.0}/docs/admin.rst +17 -1
  16. {python-arango-7.9.1 → python_arango-8.0.0}/docs/cluster.rst +6 -1
  17. python_arango-8.0.0/docs/compression.rst +40 -0
  18. {python-arango-7.9.1 → python_arango-8.0.0}/docs/conf.py +1 -1
  19. {python-arango-7.9.1 → python_arango-8.0.0}/docs/contributing.rst +9 -11
  20. {python-arango-7.9.1 → python_arango-8.0.0}/docs/graph.rst +12 -11
  21. {python-arango-7.9.1 → python_arango-8.0.0}/docs/index.rst +46 -13
  22. {python-arango-7.9.1 → python_arango-8.0.0}/docs/indexes.rst +20 -10
  23. {python-arango-7.9.1 → python_arango-8.0.0}/docs/overview.rst +2 -2
  24. {python-arango-7.9.1 → python_arango-8.0.0}/docs/pregel.rst +5 -1
  25. {python-arango-7.9.1 → python_arango-8.0.0}/docs/simple.rst +0 -2
  26. {python-arango-7.9.1 → python_arango-8.0.0}/docs/specs.rst +6 -0
  27. {python-arango-7.9.1 → python_arango-8.0.0}/docs/transaction.rst +10 -0
  28. {python-arango-7.9.1 → python_arango-8.0.0}/pyproject.toml +2 -2
  29. {python-arango-7.9.1 → python_arango-8.0.0}/python_arango.egg-info/PKG-INFO +19 -18
  30. {python-arango-7.9.1 → python_arango-8.0.0}/python_arango.egg-info/SOURCES.txt +1 -0
  31. {python-arango-7.9.1 → python_arango-8.0.0}/starter.sh +5 -4
  32. {python-arango-7.9.1 → python_arango-8.0.0}/.github/workflows/codeql.yaml +0 -0
  33. {python-arango-7.9.1 → python_arango-8.0.0}/.github/workflows/docs.yaml +0 -0
  34. {python-arango-7.9.1 → python_arango-8.0.0}/.github/workflows/pypi.yaml +0 -0
  35. {python-arango-7.9.1 → python_arango-8.0.0}/.gitignore +0 -0
  36. {python-arango-7.9.1 → python_arango-8.0.0}/.pre-commit-config.yaml +0 -0
  37. {python-arango-7.9.1 → python_arango-8.0.0}/.readthedocs.yaml +0 -0
  38. {python-arango-7.9.1 → python_arango-8.0.0}/CONTRIBUTING.md +0 -0
  39. {python-arango-7.9.1 → python_arango-8.0.0}/LICENSE +0 -0
  40. {python-arango-7.9.1 → python_arango-8.0.0}/MANIFEST.in +0 -0
  41. {python-arango-7.9.1 → python_arango-8.0.0}/arango/__init__.py +0 -0
  42. {python-arango-7.9.1 → python_arango-8.0.0}/arango/api.py +0 -0
  43. {python-arango-7.9.1 → python_arango-8.0.0}/arango/aql.py +0 -0
  44. {python-arango-7.9.1 → python_arango-8.0.0}/arango/backup.py +0 -0
  45. {python-arango-7.9.1 → python_arango-8.0.0}/arango/cursor.py +0 -0
  46. {python-arango-7.9.1 → python_arango-8.0.0}/arango/errno.py +0 -0
  47. {python-arango-7.9.1 → python_arango-8.0.0}/arango/foxx.py +0 -0
  48. {python-arango-7.9.1 → python_arango-8.0.0}/arango/job.py +0 -0
  49. {python-arango-7.9.1 → python_arango-8.0.0}/arango/pregel.py +0 -0
  50. {python-arango-7.9.1 → python_arango-8.0.0}/arango/py.typed +0 -0
  51. {python-arango-7.9.1 → python_arango-8.0.0}/arango/request.py +0 -0
  52. {python-arango-7.9.1 → python_arango-8.0.0}/arango/resolver.py +0 -0
  53. {python-arango-7.9.1 → python_arango-8.0.0}/arango/response.py +0 -0
  54. {python-arango-7.9.1 → python_arango-8.0.0}/arango/result.py +0 -0
  55. {python-arango-7.9.1 → python_arango-8.0.0}/arango/typings.py +0 -0
  56. {python-arango-7.9.1 → python_arango-8.0.0}/arango/utils.py +0 -0
  57. {python-arango-7.9.1 → python_arango-8.0.0}/arango/wal.py +0 -0
  58. {python-arango-7.9.1 → python_arango-8.0.0}/docs/Makefile +0 -0
  59. {python-arango-7.9.1 → python_arango-8.0.0}/docs/analyzer.rst +0 -0
  60. {python-arango-7.9.1 → python_arango-8.0.0}/docs/aql.rst +0 -0
  61. {python-arango-7.9.1 → python_arango-8.0.0}/docs/async.rst +0 -0
  62. {python-arango-7.9.1 → python_arango-8.0.0}/docs/auth.rst +0 -0
  63. {python-arango-7.9.1 → python_arango-8.0.0}/docs/backup.rst +0 -0
  64. {python-arango-7.9.1 → python_arango-8.0.0}/docs/batch.rst +0 -0
  65. {python-arango-7.9.1 → python_arango-8.0.0}/docs/certificates.rst +0 -0
  66. {python-arango-7.9.1 → python_arango-8.0.0}/docs/collection.rst +0 -0
  67. {python-arango-7.9.1 → python_arango-8.0.0}/docs/cursor.rst +0 -0
  68. {python-arango-7.9.1 → python_arango-8.0.0}/docs/database.rst +0 -0
  69. {python-arango-7.9.1 → python_arango-8.0.0}/docs/document.rst +0 -0
  70. {python-arango-7.9.1 → python_arango-8.0.0}/docs/errno.rst +0 -0
  71. {python-arango-7.9.1 → python_arango-8.0.0}/docs/errors.rst +0 -0
  72. {python-arango-7.9.1 → python_arango-8.0.0}/docs/foxx.rst +0 -0
  73. {python-arango-7.9.1 → python_arango-8.0.0}/docs/http.rst +0 -0
  74. {python-arango-7.9.1 → python_arango-8.0.0}/docs/logging.rst +0 -0
  75. {python-arango-7.9.1 → python_arango-8.0.0}/docs/make.bat +0 -0
  76. {python-arango-7.9.1 → python_arango-8.0.0}/docs/overload.rst +0 -0
  77. {python-arango-7.9.1 → python_arango-8.0.0}/docs/replication.rst +0 -0
  78. {python-arango-7.9.1 → python_arango-8.0.0}/docs/requirements.txt +0 -0
  79. {python-arango-7.9.1 → python_arango-8.0.0}/docs/schema.rst +0 -0
  80. {python-arango-7.9.1 → python_arango-8.0.0}/docs/serializer.rst +0 -0
  81. {python-arango-7.9.1 → python_arango-8.0.0}/docs/static/logo.png +0 -0
  82. {python-arango-7.9.1 → python_arango-8.0.0}/docs/task.rst +0 -0
  83. {python-arango-7.9.1 → python_arango-8.0.0}/docs/threading.rst +0 -0
  84. {python-arango-7.9.1 → python_arango-8.0.0}/docs/user.rst +0 -0
  85. {python-arango-7.9.1 → python_arango-8.0.0}/docs/view.rst +0 -0
  86. {python-arango-7.9.1 → python_arango-8.0.0}/docs/wal.rst +0 -0
  87. {python-arango-7.9.1 → python_arango-8.0.0}/python_arango.egg-info/dependency_links.txt +0 -0
  88. {python-arango-7.9.1 → python_arango-8.0.0}/python_arango.egg-info/requires.txt +0 -0
  89. {python-arango-7.9.1 → python_arango-8.0.0}/python_arango.egg-info/top_level.txt +0 -0
  90. {python-arango-7.9.1 → python_arango-8.0.0}/setup.cfg +0 -0
  91. {python-arango-7.9.1 → python_arango-8.0.0}/setup.py +0 -0
@@ -15,7 +15,7 @@ workflows:
15
15
  python_version: ["3.8", "3.9", "3.10", "3.11"] # "3.12"
16
16
  arangodb_config: ["single", "cluster"]
17
17
  arangodb_license: ["community", "enterprise"]
18
- arangodb_version: ["3.10.10", "3.11.4", "latest"]
18
+ arangodb_version: ["3.11", "latest"]
19
19
 
20
20
  jobs:
21
21
  lint:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-arango
3
- Version: 7.9.1
3
+ Version: 8.0.0
4
4
  Summary: Python Driver for ArangoDB
5
5
  Author-email: Joohwan Oh <joohwan.oh@outlook.com>
6
- Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
6
+ Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
7
7
  License: MIT License
8
8
 
9
9
  Copyright (c) 2016-2021 Joohwan Oh
@@ -26,7 +26,7 @@ License: MIT License
26
26
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
27
  SOFTWARE.
28
28
 
29
- Project-URL: homepage, https://github.com/ArangoDB-Community/python-arango
29
+ Project-URL: homepage, https://github.com/arangodb/python-arango
30
30
  Keywords: arangodb,python,driver
31
31
  Classifier: Intended Audience :: Developers
32
32
  Classifier: License :: OSI Approved :: MIT License
@@ -67,16 +67,16 @@ Requires-Dist: types-setuptools; extra == "dev"
67
67
 
68
68
  ![Logo](https://user-images.githubusercontent.com/2701938/108583516-c3576680-72ee-11eb-883f-2d9b52e74e45.png)
69
69
 
70
- [![CircleCI](https://dl.circleci.com/status-badge/img/gh/ArangoDB-Community/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ArangoDB-Community/python-arango/tree/main)
71
- [![CodeQL](https://github.com/ArangoDB-Community/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/ArangoDB-Community/python-arango/actions/workflows/codeql.yaml)
72
- [![Docs](https://github.com/ArangoDB-Community/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/ArangoDB-Community/python-arango/actions/workflows/docs.yaml)
73
- [![Coverage Status](https://codecov.io/gh/ArangoDB-Community/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/ArangoDB-Community/python-arango)
74
- [![Last commit](https://img.shields.io/github/last-commit/ArangoDB-Community/python-arango)](https://github.com/ArangoDB-Community/python-arango/commits/master)
70
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/arangodb/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)
71
+ [![CodeQL](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)
72
+ [![Docs](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)
73
+ [![Coverage Status](https://codecov.io/gh/arangodb/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/arangodb/python-arango)
74
+ [![Last commit](https://img.shields.io/github/last-commit/arangodb/python-arango)](https://github.com/arangodb/python-arango/commits/master)
75
75
 
76
76
  [![PyPI version badge](https://img.shields.io/pypi/v/python-arango?color=3775A9&style=for-the-badge&logo=pypi&logoColor=FFD43B)](https://pypi.org/project/python-arango/)
77
77
  [![Python versions badge](https://img.shields.io/badge/3.8%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango/)
78
78
 
79
- [![License](https://img.shields.io/github/license/ArangoDB-Community/python-arango?color=9E2165&style=for-the-badge)](https://github.com/ArangoDB-Community/python-arango/blob/master/LICENSE)
79
+ [![License](https://img.shields.io/github/license/arangodb/python-arango?color=9E2165&style=for-the-badge)](https://github.com/arangodb/python-arango/blob/master/LICENSE)
80
80
  [![Code style: black](https://img.shields.io/static/v1?style=for-the-badge&label=code%20style&message=black&color=black)](https://github.com/psf/black)
81
81
  [![Downloads](https://img.shields.io/pepy/dt/python-arango?style=for-the-badge&color=282661
82
82
  )](https://pepy.tech/project/python-arango)
@@ -88,7 +88,7 @@ database natively supporting documents, graphs and search.
88
88
 
89
89
  ## Requirements
90
90
 
91
- - ArangoDB version 3.9+
91
+ - ArangoDB version 3.11+
92
92
  - Python version 3.8+
93
93
 
94
94
  ## Installation
@@ -119,8 +119,8 @@ db = client.db("test", username="root", password="passwd")
119
119
  # Create a new collection named "students".
120
120
  students = db.create_collection("students")
121
121
 
122
- # Add a hash index to the collection.
123
- students.add_hash_index(fields=["name"], unique=True)
122
+ # Add a persistent index to the collection.
123
+ students.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})
124
124
 
125
125
  # Insert new documents into the collection.
126
126
  students.insert({"name": "jane", "age": 39})
@@ -180,12 +180,13 @@ edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
180
180
  edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
181
181
  edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
182
182
 
183
- # Traverse the graph in outbound direction, breadth-first.
184
- result = graph.traverse(
185
- start_vertex="students/01",
186
- direction="outbound",
187
- strategy="breadthfirst"
188
- )
183
+ # Traverse the graph in outbound direction, breath-first.
184
+ query = """
185
+ FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
186
+ OPTIONS { bfs: true, uniqueVertices: 'global' }
187
+ RETURN {vertex: v, edge: e, path: p}
188
+ """
189
+ cursor = db.aql.execute(query)
189
190
  ```
190
191
 
191
192
  Please see the [documentation](https://docs.python-arango.com) for more details.
@@ -1,15 +1,15 @@
1
1
  ![Logo](https://user-images.githubusercontent.com/2701938/108583516-c3576680-72ee-11eb-883f-2d9b52e74e45.png)
2
2
 
3
- [![CircleCI](https://dl.circleci.com/status-badge/img/gh/ArangoDB-Community/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ArangoDB-Community/python-arango/tree/main)
4
- [![CodeQL](https://github.com/ArangoDB-Community/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/ArangoDB-Community/python-arango/actions/workflows/codeql.yaml)
5
- [![Docs](https://github.com/ArangoDB-Community/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/ArangoDB-Community/python-arango/actions/workflows/docs.yaml)
6
- [![Coverage Status](https://codecov.io/gh/ArangoDB-Community/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/ArangoDB-Community/python-arango)
7
- [![Last commit](https://img.shields.io/github/last-commit/ArangoDB-Community/python-arango)](https://github.com/ArangoDB-Community/python-arango/commits/master)
3
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/arangodb/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)
4
+ [![CodeQL](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)
5
+ [![Docs](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)
6
+ [![Coverage Status](https://codecov.io/gh/arangodb/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/arangodb/python-arango)
7
+ [![Last commit](https://img.shields.io/github/last-commit/arangodb/python-arango)](https://github.com/arangodb/python-arango/commits/master)
8
8
 
9
9
  [![PyPI version badge](https://img.shields.io/pypi/v/python-arango?color=3775A9&style=for-the-badge&logo=pypi&logoColor=FFD43B)](https://pypi.org/project/python-arango/)
10
10
  [![Python versions badge](https://img.shields.io/badge/3.8%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango/)
11
11
 
12
- [![License](https://img.shields.io/github/license/ArangoDB-Community/python-arango?color=9E2165&style=for-the-badge)](https://github.com/ArangoDB-Community/python-arango/blob/master/LICENSE)
12
+ [![License](https://img.shields.io/github/license/arangodb/python-arango?color=9E2165&style=for-the-badge)](https://github.com/arangodb/python-arango/blob/master/LICENSE)
13
13
  [![Code style: black](https://img.shields.io/static/v1?style=for-the-badge&label=code%20style&message=black&color=black)](https://github.com/psf/black)
14
14
  [![Downloads](https://img.shields.io/pepy/dt/python-arango?style=for-the-badge&color=282661
15
15
  )](https://pepy.tech/project/python-arango)
@@ -21,7 +21,7 @@ database natively supporting documents, graphs and search.
21
21
 
22
22
  ## Requirements
23
23
 
24
- - ArangoDB version 3.9+
24
+ - ArangoDB version 3.11+
25
25
  - Python version 3.8+
26
26
 
27
27
  ## Installation
@@ -52,8 +52,8 @@ db = client.db("test", username="root", password="passwd")
52
52
  # Create a new collection named "students".
53
53
  students = db.create_collection("students")
54
54
 
55
- # Add a hash index to the collection.
56
- students.add_hash_index(fields=["name"], unique=True)
55
+ # Add a persistent index to the collection.
56
+ students.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})
57
57
 
58
58
  # Insert new documents into the collection.
59
59
  students.insert({"name": "jane", "age": 39})
@@ -113,12 +113,13 @@ edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
113
113
  edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
114
114
  edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
115
115
 
116
- # Traverse the graph in outbound direction, breadth-first.
117
- result = graph.traverse(
118
- start_vertex="students/01",
119
- direction="outbound",
120
- strategy="breadthfirst"
121
- )
116
+ # Traverse the graph in outbound direction, breath-first.
117
+ query = """
118
+ FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
119
+ OPTIONS { bfs: true, uniqueVertices: 'global' }
120
+ RETURN {vertex: v, edge: e, path: p}
121
+ """
122
+ cursor = db.aql.execute(query)
122
123
  ```
123
124
 
124
125
  Please see the [documentation](https://docs.python-arango.com) for more details.
@@ -12,8 +12,13 @@ from arango.connection import (
12
12
  JwtSuperuserConnection,
13
13
  )
14
14
  from arango.database import StandardDatabase
15
- from arango.exceptions import ServerConnectionError
16
- from arango.http import DEFAULT_REQUEST_TIMEOUT, DefaultHTTPClient, HTTPClient
15
+ from arango.exceptions import ArangoClientError, ServerConnectionError
16
+ from arango.http import (
17
+ DEFAULT_REQUEST_TIMEOUT,
18
+ DefaultHTTPClient,
19
+ HTTPClient,
20
+ RequestCompression,
21
+ )
17
22
  from arango.resolver import (
18
23
  FallbackHostResolver,
19
24
  HostResolver,
@@ -33,7 +38,7 @@ def default_serializer(x: Any) -> str:
33
38
  :return: The object serialized as a JSON string
34
39
  :rtype: str
35
40
  """
36
- return dumps(x)
41
+ return dumps(x, separators=(",", ":"))
37
42
 
38
43
 
39
44
  def default_deserializer(x: str) -> Any:
@@ -85,6 +90,12 @@ class ArangoClient:
85
90
  None: No timeout.
86
91
  int: Timeout value in seconds.
87
92
  :type request_timeout: int | float
93
+ :param request_compression: Will compress requests to the server according to
94
+ the given algorithm. No compression happens by default.
95
+ :type request_compression: arango.http.RequestCompression | None
96
+ :param response_compression: Tells the server what compression algorithm is
97
+ acceptable for the response. No compression happens by default.
98
+ :type response_compression: str | None
88
99
  """
89
100
 
90
101
  def __init__(
@@ -97,6 +108,8 @@ class ArangoClient:
97
108
  deserializer: Callable[[str], Any] = default_deserializer,
98
109
  verify_override: Union[bool, str, None] = None,
99
110
  request_timeout: Union[int, float, None] = DEFAULT_REQUEST_TIMEOUT,
111
+ request_compression: Optional[RequestCompression] = None,
112
+ response_compression: Optional[str] = None,
100
113
  ) -> None:
101
114
  if isinstance(hosts, str):
102
115
  self._hosts = [host.strip("/") for host in hosts.split(",")]
@@ -133,6 +146,9 @@ class ArangoClient:
133
146
  for session in self._sessions:
134
147
  session.verify = verify_override
135
148
 
149
+ self._request_compression = request_compression
150
+ self._response_compression = response_compression
151
+
136
152
  def __repr__(self) -> str:
137
153
  return f"<ArangoClient {','.join(self._hosts)}>"
138
154
 
@@ -183,7 +199,6 @@ class ArangoClient:
183
199
  auth_method: str = "basic",
184
200
  user_token: Optional[str] = None,
185
201
  superuser_token: Optional[str] = None,
186
- verify_certificate: bool = True,
187
202
  ) -> StandardDatabase:
188
203
  """Connect to an ArangoDB database and return the database API wrapper.
189
204
 
@@ -212,8 +227,6 @@ class ArangoClient:
212
227
  are ignored. This token is not refreshed automatically. Token
213
228
  expiry will not be checked.
214
229
  :type superuser_token: str
215
- :param verify_certificate: Verify TLS certificates.
216
- :type verify_certificate: bool
217
230
  :return: Standard database API wrapper.
218
231
  :rtype: arango.database.StandardDatabase
219
232
  :raise arango.exceptions.ServerConnectionError: If **verify** was set
@@ -231,6 +244,8 @@ class ArangoClient:
231
244
  serializer=self._serializer,
232
245
  deserializer=self._deserializer,
233
246
  superuser_token=superuser_token,
247
+ request_compression=self._request_compression,
248
+ response_compression=self._response_compression,
234
249
  )
235
250
  elif user_token is not None:
236
251
  connection = JwtConnection(
@@ -242,6 +257,8 @@ class ArangoClient:
242
257
  serializer=self._serializer,
243
258
  deserializer=self._deserializer,
244
259
  user_token=user_token,
260
+ request_compression=self._request_compression,
261
+ response_compression=self._response_compression,
245
262
  )
246
263
  elif auth_method.lower() == "basic":
247
264
  connection = BasicConnection(
@@ -254,6 +271,8 @@ class ArangoClient:
254
271
  http_client=self._http,
255
272
  serializer=self._serializer,
256
273
  deserializer=self._deserializer,
274
+ request_compression=self._request_compression,
275
+ response_compression=self._response_compression,
257
276
  )
258
277
  elif auth_method.lower() == "jwt":
259
278
  connection = JwtConnection(
@@ -266,6 +285,8 @@ class ArangoClient:
266
285
  http_client=self._http,
267
286
  serializer=self._serializer,
268
287
  deserializer=self._deserializer,
288
+ request_compression=self._request_compression,
289
+ response_compression=self._response_compression,
269
290
  )
270
291
  else:
271
292
  raise ValueError(f"invalid auth_method: {auth_method}")
@@ -276,6 +297,6 @@ class ArangoClient:
276
297
  except ServerConnectionError as err:
277
298
  raise err
278
299
  except Exception as err:
279
- raise ServerConnectionError(f"bad connection: {err}")
300
+ raise ArangoClientError(f"bad connection: {err}")
280
301
 
281
302
  return StandardDatabase(connection)
@@ -11,6 +11,7 @@ from arango.exceptions import (
11
11
  ClusterServerCountError,
12
12
  ClusterServerEngineError,
13
13
  ClusterServerIDError,
14
+ ClusterServerModeError,
14
15
  ClusterServerRoleError,
15
16
  ClusterServerStatisticsError,
16
17
  ClusterServerVersionError,
@@ -57,6 +58,27 @@ class Cluster(ApiGroup): # pragma: no cover
57
58
 
58
59
  return self._execute(request, response_handler)
59
60
 
61
+ def server_mode(self) -> Result[str]:
62
+ """Return the server mode.
63
+
64
+ In a read-only server, all write operations will fail
65
+ with an error code of 1004 (ERROR_READ_ONLY). Creating or dropping
66
+ databases and collections will also fail with error code 11 (ERROR_FORBIDDEN).
67
+
68
+ :return: Server mode. Possible values are "default" or "readonly".
69
+ :rtype: str
70
+ :raise arango.exceptions.ClusterServerModeError: If retrieval fails.
71
+ """
72
+ request = Request(method="get", endpoint="/_admin/server/mode")
73
+
74
+ def response_handler(resp: Response) -> str:
75
+ if resp.is_success:
76
+ return str(resp.body["mode"])
77
+
78
+ raise ClusterServerModeError(resp, request)
79
+
80
+ return self._execute(request, response_handler)
81
+
60
82
  def server_version(self, server_id: str) -> Result[Json]:
61
83
  """Return the version of the given server.
62
84
 
@@ -140,6 +162,58 @@ class Cluster(ApiGroup): # pragma: no cover
140
162
 
141
163
  return self._execute(request, response_handler)
142
164
 
165
+ def server_maintenance_mode(self, server_id: str) -> Result[Json]:
166
+ """Return the maintenance status for the given server.
167
+
168
+ :param server_id: Server ID.
169
+ :type server_id: str
170
+ :return: Maintenance status for the given server.
171
+ :rtype: dict
172
+ :raise arango.exceptions.ClusterMaintenanceModeError: If retrieval fails.
173
+ """
174
+ request = Request(
175
+ method="get",
176
+ endpoint=f"/_admin/cluster/maintenance/{server_id}",
177
+ )
178
+
179
+ def response_handler(resp: Response) -> Json:
180
+ if resp.is_success:
181
+ result: Json = resp.body.get("result", {})
182
+ return result
183
+
184
+ raise ClusterMaintenanceModeError(resp, request)
185
+
186
+ return self._execute(request, response_handler)
187
+
188
+ def toggle_server_maintenance_mode(
189
+ self, server_id: str, mode: str, timeout: Optional[int] = None
190
+ ) -> Result[Json]:
191
+ """Enable or disable the maintenance mode for the given server.
192
+
193
+ :param server_id: Server ID.
194
+ :type server_id: str
195
+ :param mode: Maintenance mode. Allowed values are "normal" and "maintenance".
196
+ :type mode: str
197
+ :param timeout: Timeout in seconds.
198
+ :type timeout: Optional[int]
199
+ :return: Result of the operation.
200
+ :rtype: dict
201
+ :raise arango.exceptions.ClusterMaintenanceModeError: If toggle fails.
202
+ """
203
+ request = Request(
204
+ method="put",
205
+ endpoint=f"/_admin/cluster/maintenance/{server_id}",
206
+ data={"mode": mode, "timeout": timeout},
207
+ )
208
+
209
+ def response_handler(resp: Response) -> Json:
210
+ if resp.is_success:
211
+ return format_body(resp.body)
212
+
213
+ raise ClusterMaintenanceModeError(resp, request)
214
+
215
+ return self._execute(request, response_handler)
216
+
143
217
  def health(self) -> Result[Json]:
144
218
  """Return the cluster health.
145
219