python-arango-async 1.2.6__py3-none-any.whl → 1.2.8__py3-none-any.whl

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.
arangoasync/client.py CHANGED
@@ -163,16 +163,22 @@ class ArangoClient:
163
163
  - "basic": HTTP authentication.
164
164
  Requires the `auth` parameter. The `token` parameter is ignored.
165
165
  - "jwt": User JWT authentication.
166
- At least one of the `auth` or `token` parameters are required.
167
- If `auth` is provided, but the `token` is not, the token will be
168
- refreshed automatically. This assumes that the clocks of the server
169
- and client are synchronized.
166
+ At least one of `auth` or `token` is required.
167
+ Credentials in `auth` allow token acquisition and renewal,
168
+ including when an initial `token` is provided. Without a token,
169
+ acquisition happens on the first request. After HTTP 401,
170
+ a locally expired token triggers renewal and one replay.
171
+ Keep client and server clocks synchronized.
170
172
  - "superuser": Superuser JWT authentication.
171
173
  The `token` parameter is required. The `auth` parameter is ignored.
172
- auth (Auth | None): Login information (username and password) or
173
- access token.
174
- token (JwtToken | None): JWT token.
174
+ auth (Auth | str | None): Login information (username and password) or
175
+ access token. A string is used as the password with an empty username.
176
+ token (JwtToken | None): Initial JWT token. With `auth_method="jwt"`,
177
+ provide `auth` as well to allow renewal. Without credentials,
178
+ a 401 after local expiration raises `JWTRefreshError`.
175
179
  verify (bool): Verify the connection by sending a test request.
180
+ For JWT authentication without an initial token, this also triggers
181
+ acquisition before returning the database wrapper.
176
182
  compression (CompressionManager | None): If set, supersedes the
177
183
  client-level compression settings.
178
184
  serializer (Serializer | None): If set, supersedes the client-level
@@ -186,6 +192,7 @@ class ArangoClient:
186
192
  Raises:
187
193
  ValueError: If the authentication is invalid.
188
194
  ServerConnectionError: If `verify` is `True` and the connection fails.
195
+ JWTRefreshError: If `verify` is `True` and JWT acquisition or renewal fails.
189
196
  """
190
197
  connection: Connection
191
198
 
arangoasync/connection.py CHANGED
@@ -178,6 +178,7 @@ class BaseConnection(ABC):
178
178
 
179
179
  if request.prefix_needed:
180
180
  request.endpoint = f"{self._db_endpoint}{request.endpoint}"
181
+ request.prefix_needed = False
181
182
  host_index = self._host_resolver.get_host_index()
182
183
  for tries in range(self._host_resolver.max_tries):
183
184
  try:
@@ -432,6 +433,7 @@ class JwtConnection(BaseConnection):
432
433
  ):
433
434
  # If the token has expired, refresh it and retry the request
434
435
  await self.refresh_token()
436
+ request.headers["authorization"] = self._auth_header
435
437
  resp = await self.process_request(request)
436
438
  return resp
437
439
 
arangoasync/database.py CHANGED
@@ -1240,11 +1240,18 @@ class Database:
1240
1240
  edge collection), "from" (list of vertex collection names) and "to"
1241
1241
  (list of vertex collection names).
1242
1242
  is_disjoint (bool | None): Whether to create a Disjoint SmartGraph
1243
- instead of a regular SmartGraph (Enterprise Edition only).
1244
- is_smart (bool | None): Define if the created graph should be smart
1245
- (Enterprise Edition only).
1243
+ instead of a regular SmartGraph. Only has an effect with
1244
+ `smart_graph_attribute` or `is_smart` (Enterprise Edition only).
1245
+ Deprecated: use `GraphOptions.is_disjoint` instead.
1246
+ is_smart (bool | None): If `True`, create a SmartGraph when
1247
+ `options.smart_graph_attribute` is set, or an EnterpriseGraph
1248
+ otherwise. Ignored for SatelliteGraphs (Enterprise Edition only).
1249
+ Deprecated: use `GraphOptions.is_smart` instead.
1246
1250
  options (GraphOptions | dict | None): Options for creating collections
1247
- within this graph.
1251
+ within this graph. Setting `smart_graph_attribute` creates a
1252
+ SmartGraph even if `is_smart` is omitted or `False`. Explicit
1253
+ `is_smart` and `is_disjoint` arguments override the corresponding
1254
+ entries in these options.
1248
1255
  orphan_collections (list | None): An array of additional vertex
1249
1256
  collections. Documents in these collections do not have edges
1250
1257
  within this graph.
@@ -1260,6 +1267,15 @@ class Database:
1260
1267
  References:
1261
1268
  - `create-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#create-a-graph>`__
1262
1269
  """ # noqa: E501
1270
+ if is_smart is not None or is_disjoint is not None:
1271
+ warn(
1272
+ "The separate is_smart and is_disjoint arguments are deprecated; "
1273
+ "pass these flags through GraphOptions or the options "
1274
+ "dictionary instead.",
1275
+ DeprecationWarning,
1276
+ stacklevel=2,
1277
+ )
1278
+
1263
1279
  params: Params = {}
1264
1280
  if wait_for_sync is not None:
1265
1281
  params["waitForSync"] = wait_for_sync
@@ -1267,15 +1283,15 @@ class Database:
1267
1283
  data: Json = {"name": name}
1268
1284
  if edge_definitions is not None:
1269
1285
  data["edgeDefinitions"] = edge_definitions
1270
- if is_disjoint is not None:
1271
- data["isDisjoint"] = is_disjoint
1272
- if is_smart is not None:
1273
- data["isSmart"] = is_smart
1274
1286
  if options is not None:
1275
1287
  if isinstance(options, GraphOptions):
1276
- data["options"] = options.to_dict()
1288
+ data["options"] = options.to_dict().copy()
1277
1289
  else:
1278
- data["options"] = options
1290
+ data["options"] = options.copy()
1291
+ if is_disjoint is not None:
1292
+ data.setdefault("options", {})["isDisjoint"] = is_disjoint
1293
+ if is_smart is not None:
1294
+ data.setdefault("options", {})["isSmart"] = is_smart
1279
1295
  if orphan_collections is not None:
1280
1296
  data["orphanCollections"] = orphan_collections
1281
1297
 
arangoasync/graph.py CHANGED
@@ -87,10 +87,11 @@ class Graph(Generic[T, U, V]):
87
87
  """Get the properties of the graph.
88
88
 
89
89
  Returns:
90
- GraphProperties: Properties of the graph.
90
+ GraphProperties: Properties of the graph, including `is_smart`,
91
+ `is_disjoint`, and `smart_graph_attribute`.
91
92
 
92
93
  Raises:
93
- GraphProperties: If the operation fails.
94
+ GraphPropertiesError: If the operation fails.
94
95
 
95
96
  References:
96
97
  - `get-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#get-a-graph>`__
arangoasync/typings.py CHANGED
@@ -1873,6 +1873,16 @@ class GraphProperties(JsonWrapper):
1873
1873
  """Check if the graph is a smart graph."""
1874
1874
  return cast(bool, self._data.get("isSmart", False))
1875
1875
 
1876
+ @property
1877
+ def is_disjoint(self) -> bool:
1878
+ """Check if the graph is a Disjoint SmartGraph."""
1879
+ return cast(bool, self._data.get("isDisjoint", False))
1880
+
1881
+ @property
1882
+ def smart_graph_attribute(self) -> Optional[str]:
1883
+ """Return the sharding attribute for a SmartGraph, if present."""
1884
+ return cast(Optional[str], self._data.get("smartGraphAttribute"))
1885
+
1876
1886
  @property
1877
1887
  def is_satellite(self) -> bool:
1878
1888
  """Check if the graph is a satellite graph."""
@@ -1963,6 +1973,10 @@ class GraphOptions(JsonWrapper):
1963
1973
  Enterprise Edition.
1964
1974
  write_concern (int | None): The write concern for new collections in the
1965
1975
  graph.
1976
+ is_smart (bool | None): Create a SmartGraph when `smart_graph_attribute`
1977
+ is set, or an EnterpriseGraph otherwise. Ignored for SatelliteGraphs.
1978
+ is_disjoint (bool | None): Create a Disjoint SmartGraph. Only has an
1979
+ effect with `smart_graph_attribute` or `is_smart`.
1966
1980
 
1967
1981
  References:
1968
1982
  - `create-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#create-a-graph>`__
@@ -1975,6 +1989,8 @@ class GraphOptions(JsonWrapper):
1975
1989
  satellites: Optional[List[str]] = None,
1976
1990
  smart_graph_attribute: Optional[str] = None,
1977
1991
  write_concern: Optional[int] = None,
1992
+ is_smart: Optional[bool] = None,
1993
+ is_disjoint: Optional[bool] = None,
1978
1994
  ) -> None:
1979
1995
  data: Json = dict()
1980
1996
  if number_of_shards is not None:
@@ -1987,8 +2003,20 @@ class GraphOptions(JsonWrapper):
1987
2003
  data["smartGraphAttribute"] = smart_graph_attribute
1988
2004
  if write_concern is not None:
1989
2005
  data["writeConcern"] = write_concern
2006
+ if is_smart is not None:
2007
+ data["isSmart"] = is_smart
2008
+ if is_disjoint is not None:
2009
+ data["isDisjoint"] = is_disjoint
1990
2010
  super().__init__(data)
1991
2011
 
2012
+ @property
2013
+ def is_smart(self) -> Optional[bool]:
2014
+ return cast(Optional[bool], self._data.get("isSmart"))
2015
+
2016
+ @property
2017
+ def is_disjoint(self) -> Optional[bool]:
2018
+ return cast(Optional[bool], self._data.get("isDisjoint"))
2019
+
1992
2020
  @property
1993
2021
  def number_of_shards(self) -> Optional[int]:
1994
2022
  return cast(int, self._data.get("numberOfShards"))
arangoasync/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.6"
1
+ __version__ = "1.2.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-arango-async
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Async Python Driver for ArangoDB
5
5
  Author-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
6
6
  Maintainer-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
@@ -2,18 +2,18 @@ arangoasync/__init__.py,sha256=HEJ7_q_pRcS9Gco3poa89jLQr_zDrDrHAXCEJMgjUFI,196
2
2
  arangoasync/aql.py,sha256=wUB6K2if5IGk6ucIVa5mxjWjQGG7l6p7xdtj39b6yn8,30541
3
3
  arangoasync/auth.py,sha256=16apz1_IvAB_ZSyenoPha6F_JkbHokmOWFHxPL_swxQ,3025
4
4
  arangoasync/backup.py,sha256=6ZUDjP44bilv056K2fo8l7BnmoeksJ9G9keMVP7i9FI,10577
5
- arangoasync/client.py,sha256=MKLYXPdDhBezFIKX1H5e7-dKzYnIHwbfN0CO8AEsAzs,10054
5
+ arangoasync/client.py,sha256=nN4BhuX9-KOgvB4buMjGXZLZsdFUiWQpvVo9h1P2CMs,10684
6
6
  arangoasync/cluster.py,sha256=64GYlpz07wBczeNTrPpxnUd17tFocrhGijGHF_dqdoo,17260
7
7
  arangoasync/collection.py,sha256=BXpFmCxqzB4qkCMMIJth4abq3ehHh62MEYovIzicFCY,124186
8
8
  arangoasync/compression.py,sha256=vMhcg5nQPkbgplk48vxARUnJ6YeIwrCLC6pDCVJSwo0,3804
9
- arangoasync/connection.py,sha256=f6HQOZHayluNVyH-j-sujlE_dvQrVxC1lPWnzrfQLqY,17459
9
+ arangoasync/connection.py,sha256=jU7SG53teq1KeUfl9cfHFRu6-047wVVQ08Olnou39KU,17566
10
10
  arangoasync/cursor.py,sha256=RQJOtNpxEx5n3eKx7UYPl1N8gzWYQESjufvakr18azk,8464
11
- arangoasync/database.py,sha256=tjdxJBJ5q6X8Q5qIVTLKPb6-tEPnNKV9EUIa-k1_K9Q,139492
11
+ arangoasync/database.py,sha256=8GfFG9ZhfjsThoXeNCZkIBbf-LrlkSOx-hgLjw-eTA8,140476
12
12
  arangoasync/errno.py,sha256=4oKY9IyyzjOitbywhjH8S214qeNtpDlQg7JsHENJNoU,25245
13
13
  arangoasync/exceptions.py,sha256=lyb5iWMj71nNli32t23AWXKyOldQEJRuKoChtf0uBss,20000
14
14
  arangoasync/executor.py,sha256=eRUfWQc4eHgJr15nPnDju8oSK0408x6yB8XEGk7YhPY,4740
15
15
  arangoasync/foxx.py,sha256=qksGB7Y65_J4f6uThQzBHvmIOzjomslV4pIqohtBS54,28924
16
- arangoasync/graph.py,sha256=G-todTf-ldTQtS2uhCsiigdPL4WABbbfTrLKlIPFkhA,40953
16
+ arangoasync/graph.py,sha256=gl5DTOb4wi8XFq3_3_sm1sQ23EDo8_-n-_icOgGJhpM,41040
17
17
  arangoasync/http.py,sha256=xkxnLMbqFBEngmqGCuBOgRuXgQSBUk9-dzYXB1yrL98,6154
18
18
  arangoasync/job.py,sha256=B9cPDzxaYflWDj95j941wrcCj4w5j-gnmSzs3TdNdfw,7471
19
19
  arangoasync/logger.py,sha256=Ui4n-ELcYM4fujpZV6myU4by82L_70S1cfG0bhEhf-Q,58
@@ -23,10 +23,10 @@ arangoasync/resolver.py,sha256=icsmQIkklrvq-a88vIR8C-M3rcv5BJxhDE2PK8LenG0,3409
23
23
  arangoasync/response.py,sha256=VMnoWgtyrh1JGK7mEgRNsUtSawxWMgFjHT-Cff4d8zc,2132
24
24
  arangoasync/result.py,sha256=NVwFxpYUDujHNRCqCZIBOlGLzB7XsiSmjWPFhUgRS6k,233
25
25
  arangoasync/serialization.py,sha256=ExRqrEpbk11Hb3AfFUJGqPlGBD3dbvwQg_xsZUsrm6I,2910
26
- arangoasync/typings.py,sha256=LmKV4_jNUoxZ6cI91l8H2XimhYl945ow_3FrcVEoB50,70480
27
- arangoasync/version.py,sha256=vMQK58X8_YZGKzRm0ThvPAKFtpfyejGmUnDrY9RQ13w,22
28
- python_arango_async-1.2.6.dist-info/licenses/LICENSE,sha256=6zoGhJon2tcnvzmycirNjLNBZ6rlLJtYDdVGO76RXVM,1065
29
- python_arango_async-1.2.6.dist-info/METADATA,sha256=TKW7gucdxOvQ7kogYUJjHU8APhWIg9N0sV3zGNPKzhA,7943
30
- python_arango_async-1.2.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
31
- python_arango_async-1.2.6.dist-info/top_level.txt,sha256=uabwJ6t-MiIaZQXGUvYikeSbZDcF0RK37GzikBnDz5k,12
32
- python_arango_async-1.2.6.dist-info/RECORD,,
26
+ arangoasync/typings.py,sha256=Pk738JV370ryqcD72_v1TGVAPePIsfyuWk3ZSQtE5hc,71656
27
+ arangoasync/version.py,sha256=CfVXm0wwlKPW0khOcwhWw61TpgtZiLijCePsAIOK3aU,22
28
+ python_arango_async-1.2.8.dist-info/licenses/LICENSE,sha256=6zoGhJon2tcnvzmycirNjLNBZ6rlLJtYDdVGO76RXVM,1065
29
+ python_arango_async-1.2.8.dist-info/METADATA,sha256=ipV1rWwxVE2n3M5k3c7MThGx0tbnG-PQU6bVv9ZQ_IY,7943
30
+ python_arango_async-1.2.8.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
31
+ python_arango_async-1.2.8.dist-info/top_level.txt,sha256=uabwJ6t-MiIaZQXGUvYikeSbZDcF0RK37GzikBnDz5k,12
32
+ python_arango_async-1.2.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (84.0.0)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5