python-arango 8.3.6__tar.gz → 8.3.8__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.
- python_arango-8.3.8/.agents/skills/python-arango-development/SKILL.md +69 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/.circleci/config.yml +2 -9
- {python_arango-8.3.6 → python_arango-8.3.8}/.gitignore +2 -0
- {python_arango-8.3.6/python_arango.egg-info → python_arango-8.3.8}/PKG-INFO +1 -1
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/connection.py +2 -1
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/database.py +15 -18
- python_arango-8.3.8/arango/version.py +1 -0
- python_arango-8.3.8/docs/auth.rst +169 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/graph.rst +31 -0
- {python_arango-8.3.6 → python_arango-8.3.8/python_arango.egg-info}/PKG-INFO +1 -1
- {python_arango-8.3.6 → python_arango-8.3.8}/python_arango.egg-info/SOURCES.txt +1 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/python_arango.egg-info/scm_file_list.json +1 -0
- python_arango-8.3.8/python_arango.egg-info/scm_version.json +8 -0
- python_arango-8.3.6/arango/version.py +0 -1
- python_arango-8.3.6/docs/auth.rst +0 -117
- python_arango-8.3.6/python_arango.egg-info/scm_version.json +0 -8
- {python_arango-8.3.6 → python_arango-8.3.8}/.github/workflows/codeql.yaml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/.github/workflows/docs.yaml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/.github/workflows/pypi.yaml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/.pre-commit-config.yaml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/.readthedocs.yaml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/AGENTS.md +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/LICENSE +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/MANIFEST.in +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/README.md +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/__init__.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/api.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/aql.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/backup.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/client.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/cluster.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/collection.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/cursor.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/errno.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/exceptions.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/executor.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/formatter.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/foxx.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/graph.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/http.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/job.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/pregel.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/py.typed +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/replication.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/request.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/resolver.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/response.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/result.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/typings.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/utils.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/arango/wal.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/Makefile +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/admin.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/analyzer.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/aql.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/async.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/backup.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/batch.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/certificates.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/cluster.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/collection.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/compression.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/conf.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/cursor.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/database.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/document.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/errno.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/errors.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/foxx.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/http.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/index.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/indexes.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/logging.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/make.bat +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/overload.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/overview.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/pregel.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/replication.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/requirements.txt +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/schema.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/serializer.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/simple.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/specs.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/static/logo.png +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/task.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/threading.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/transaction.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/user.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/view.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/docs/wal.rst +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/pyproject.toml +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/python_arango.egg-info/dependency_links.txt +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/python_arango.egg-info/requires.txt +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/python_arango.egg-info/top_level.txt +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/setup.cfg +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/setup.py +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/starter.sh +0 -0
- {python_arango-8.3.6 → python_arango-8.3.8}/todo.md +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-arango-development
|
|
3
|
+
description: >-
|
|
4
|
+
Maintain and extend python-arango, the ArangoDB Python driver. Use for
|
|
5
|
+
driver features, bug fixes, refactoring, and related tests or documentation,
|
|
6
|
+
rather than application code that uses the driver.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Python driver development
|
|
10
|
+
|
|
11
|
+
Follow the repository's [AGENTS.md](../../../AGENTS.md) for setup, validation
|
|
12
|
+
commands, and contribution rules.
|
|
13
|
+
|
|
14
|
+
Before changing an operation, trace a neighboring method with a similar
|
|
15
|
+
request and response shape. Public API methods usually construct a `Request`,
|
|
16
|
+
define a response handler, and call `self._execute(request, response_handler)`.
|
|
17
|
+
See `arango/api.py`, `arango/request.py`, and the API group being changed.
|
|
18
|
+
Keep request construction and response conversion at the same layer as the
|
|
19
|
+
neighboring operations.
|
|
20
|
+
|
|
21
|
+
Preserve execution through `_execute` when following this pattern. It delegates
|
|
22
|
+
to the configured executor in `arango/executor.py`, supporting default, async,
|
|
23
|
+
batch, and transaction contexts. Calling the connection directly can bypass
|
|
24
|
+
that behavior. Preserve `Result[T]` annotations where applicable: an operation
|
|
25
|
+
can return a value, an async or batch job, or `None`, depending on its context.
|
|
26
|
+
See `arango/result.py` for the shared type.
|
|
27
|
+
|
|
28
|
+
For endpoint or option changes, verify the server HTTP API for the targeted
|
|
29
|
+
ArangoDB versions. Map Python option names to the specified wire names and
|
|
30
|
+
locations: endpoint path, `params` for query parameters, `headers`, or `data`
|
|
31
|
+
for the body. Preserve existing defaults and distinguish omitted options from
|
|
32
|
+
explicit `False`, `0`, or empty values. Where `None` means omission, use
|
|
33
|
+
`is not None` rather than a truthiness check. `normalize_params` in `arango/request.py`
|
|
34
|
+
stringifies supplied values, including `None`; omit such query entries before
|
|
35
|
+
constructing the request. Keep explicit JSON nulls where the body contract
|
|
36
|
+
requires them.
|
|
37
|
+
|
|
38
|
+
Follow the neighboring handler's success checks and response formatting;
|
|
39
|
+
reuse helpers in `arango/formatter.py` where applicable. Preserve Python-facing
|
|
40
|
+
field names, return shapes, and silent-operation results. Handle special
|
|
41
|
+
statuses before the general failure check where required, such as revision
|
|
42
|
+
conflicts. Raise the operation-specific exception from `arango/exceptions.py`
|
|
43
|
+
with `(resp, request)` to retain HTTP and ArangoDB error details. Keep signatures,
|
|
44
|
+
annotations, and Sphinx parameter and return documentation aligned. Cover
|
|
45
|
+
omitted and explicit option values, result conversion, and affected error
|
|
46
|
+
paths in regression tests.
|
|
47
|
+
|
|
48
|
+
Add focused regression coverage in the relevant `tests/test_*.py` module,
|
|
49
|
+
reusing fixtures and helpers from `tests/conftest.py` and `tests/helpers.py`.
|
|
50
|
+
Check the affected request mapping, result, or error behavior; exercise related
|
|
51
|
+
execution contexts when the change affects them.
|
|
52
|
+
|
|
53
|
+
For test selection, inspect fixture dependencies in `tests/conftest.py`.
|
|
54
|
+
Pytest normally connects to ArangoDB and creates test resources during
|
|
55
|
+
configuration, even for database-free tests or collection. Use
|
|
56
|
+
`--skip-arango-setup` only for tests that need no configured database fixtures,
|
|
57
|
+
for example:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
python -m pytest tests/test_request.py --skip-arango-setup
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This flag bypasses setup; it does not make integration tests run offline.
|
|
64
|
+
For server behavior, run the relevant test against a disposable ArangoDB
|
|
65
|
+
instance using AGENTS.md. Match the actual topology: pass `--cluster` for a
|
|
66
|
+
cluster, omit it for a single server. The flag does not start a cluster.
|
|
67
|
+
Check version and capability skips in the selected tests; skipped cases do
|
|
68
|
+
not validate the change. Start with the affected test, expand for changed
|
|
69
|
+
contracts, and report any unverified behavior.
|
|
@@ -29,13 +29,6 @@ workflows:
|
|
|
29
29
|
matrix:
|
|
30
30
|
parameters:
|
|
31
31
|
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
32
|
-
- integration-test:
|
|
33
|
-
name: ArangoDB (enterprise, 3.12.10 << matrix.arangodb_config >>)
|
|
34
|
-
matrix:
|
|
35
|
-
parameters:
|
|
36
|
-
arangodb_config: ["single", "cluster"]
|
|
37
|
-
arangodb_image: ["arangodb/enterprise:3.12.10"]
|
|
38
|
-
arangodb_conf_version: ["3.12"]
|
|
39
32
|
- integration-test:
|
|
40
33
|
name: ArangoDB (enterprise, 3.12.9 << matrix.arangodb_config >>)
|
|
41
34
|
matrix:
|
|
@@ -51,11 +44,11 @@ workflows:
|
|
|
51
44
|
arangodb_image: [ "arangodb/core-preview:4.0-nightly" ]
|
|
52
45
|
arangodb_conf_version: [ "4.0" ]
|
|
53
46
|
- integration-test:
|
|
54
|
-
name: ArangoDB (enterprise
|
|
47
|
+
name: ArangoDB (enterprise, 3.12-latest << matrix.arangodb_config >>)
|
|
55
48
|
matrix:
|
|
56
49
|
parameters:
|
|
57
50
|
arangodb_config: ["single", "cluster"]
|
|
58
|
-
arangodb_image: ["arangodb/enterprise
|
|
51
|
+
arangodb_image: ["arangodb/enterprise:3.12"]
|
|
59
52
|
arangodb_conf_version: ["3.12"]
|
|
60
53
|
|
|
61
54
|
jobs:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version: 8.3.
|
|
3
|
+
Version: 8.3.8
|
|
4
4
|
Summary: Python Driver for ArangoDB
|
|
5
5
|
Author-email: Joohwan Oh <joohwan.oh@outlook.com>
|
|
6
6
|
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
|
|
@@ -407,7 +407,8 @@ class JwtConnection(BaseConnection):
|
|
|
407
407
|
return resp
|
|
408
408
|
|
|
409
409
|
now = int(time.time())
|
|
410
|
-
|
|
410
|
+
has_credentials = self._username is not None and self._password is not None
|
|
411
|
+
if not has_credentials and self._token_exp < now - self.exp_leeway:
|
|
411
412
|
return resp
|
|
412
413
|
|
|
413
414
|
self.refresh_token()
|
|
@@ -1898,25 +1898,22 @@ class Database(ApiGroup):
|
|
|
1898
1898
|
:param orphan_collections: Names of additional vertex collections that
|
|
1899
1899
|
are not in edge definitions.
|
|
1900
1900
|
:type orphan_collections: [str] | None
|
|
1901
|
-
:param smart: If set to True,
|
|
1902
|
-
|
|
1903
|
-
ArangoDB.
|
|
1901
|
+
:param smart: If set to True, create a SmartGraph when **smart_field**
|
|
1902
|
+
is specified, or an EnterpriseGraph otherwise. Applies only to enterprise
|
|
1903
|
+
version of ArangoDB.
|
|
1904
1904
|
:type smart: bool | None
|
|
1905
1905
|
:param disjoint: If set to True, create a disjoint SmartGraph instead
|
|
1906
|
-
of a regular SmartGraph.
|
|
1907
|
-
ArangoDB.
|
|
1906
|
+
of a regular SmartGraph. Only has an effect with **smart_field**
|
|
1907
|
+
or **smart**. Applies only to enterprise version of ArangoDB.
|
|
1908
1908
|
:type disjoint: bool | None
|
|
1909
1909
|
:param smart_field: Document field used to shard the vertices of the
|
|
1910
|
-
graph.
|
|
1911
|
-
|
|
1912
|
-
to enterprise version of ArangoDB.
|
|
1913
|
-
None and **smart** is True, an Enterprise Graph will be created.
|
|
1910
|
+
graph. Setting this creates a SmartGraph, even if **smart** is
|
|
1911
|
+
omitted or False. Every vertex in the graph must have this field.
|
|
1912
|
+
Applies only to enterprise version of ArangoDB.
|
|
1914
1913
|
:type smart_field: str | None
|
|
1915
1914
|
:param shard_count: Number of shards used for every collection in the
|
|
1916
|
-
graph.
|
|
1917
|
-
|
|
1918
|
-
cannot be modified later once set. Applies only to enterprise
|
|
1919
|
-
version of ArangoDB.
|
|
1915
|
+
graph. This number cannot be modified later once set. Used for
|
|
1916
|
+
clusters only.
|
|
1920
1917
|
:type shard_count: int | None
|
|
1921
1918
|
:param replication_factor: Number of copies of each shard on different
|
|
1922
1919
|
servers in a cluster. Allowed values are 1 (only one copy is kept
|
|
@@ -1969,11 +1966,11 @@ class Database(ApiGroup):
|
|
|
1969
1966
|
]
|
|
1970
1967
|
if orphan_collections is not None:
|
|
1971
1968
|
data["orphanCollections"] = orphan_collections
|
|
1972
|
-
if smart is not None:
|
|
1973
|
-
data["isSmart"] = smart
|
|
1974
|
-
if disjoint is not None:
|
|
1975
|
-
data["isDisjoint"] = disjoint
|
|
1976
|
-
if smart_field is not None:
|
|
1969
|
+
if smart is not None:
|
|
1970
|
+
data["options"]["isSmart"] = smart
|
|
1971
|
+
if disjoint is not None:
|
|
1972
|
+
data["options"]["isDisjoint"] = disjoint
|
|
1973
|
+
if smart_field is not None:
|
|
1977
1974
|
data["options"]["smartGraphAttribute"] = smart_field
|
|
1978
1975
|
if shard_count is not None: # pragma: no cover
|
|
1979
1976
|
data["options"]["numberOfShards"] = shard_count
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "8.3.8"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Authentication
|
|
2
|
+
--------------
|
|
3
|
+
|
|
4
|
+
Python-arango supports two HTTP authentication methods: basic and JSON Web
|
|
5
|
+
Tokens (JWT).
|
|
6
|
+
|
|
7
|
+
Basic Authentication
|
|
8
|
+
====================
|
|
9
|
+
|
|
10
|
+
This is python-arango's default authentication method.
|
|
11
|
+
|
|
12
|
+
**Example:**
|
|
13
|
+
|
|
14
|
+
.. testcode::
|
|
15
|
+
from arango import ArangoClient
|
|
16
|
+
|
|
17
|
+
# Initialize the ArangoDB client.
|
|
18
|
+
client = ArangoClient()
|
|
19
|
+
|
|
20
|
+
# Connect to "test" database as root user using basic auth.
|
|
21
|
+
db = client.db('test', username='root', password='passwd')
|
|
22
|
+
|
|
23
|
+
# The authentication method can be given explicitly.
|
|
24
|
+
db = client.db(
|
|
25
|
+
'test',
|
|
26
|
+
username='root',
|
|
27
|
+
password='passwd',
|
|
28
|
+
auth_method='basic'
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
JSON Web Tokens (JWT)
|
|
32
|
+
=====================
|
|
33
|
+
|
|
34
|
+
JWTs are sent in the HTTP ``Authorization`` header as Bearer tokens. Token
|
|
35
|
+
renewal depends on whether the driver obtains tokens using username/password
|
|
36
|
+
or the application supplies them.
|
|
37
|
+
|
|
38
|
+
Driver-managed tokens
|
|
39
|
+
~~~~~~~~~~~~~~~~~~~~~
|
|
40
|
+
|
|
41
|
+
With ``auth_method='jwt'``, the driver obtains an initial token using the
|
|
42
|
+
configured username and password when ``client.db()`` is called. It retains
|
|
43
|
+
those credentials to obtain replacement tokens. If initial acquisition fails,
|
|
44
|
+
``client.db()`` raises an error instead of returning a database wrapper.
|
|
45
|
+
|
|
46
|
+
For each database request, the authentication policy is:
|
|
47
|
+
|
|
48
|
+
1. Send the request with the current token.
|
|
49
|
+
2. If the response has both HTTP status 401 and ArangoDB error code 11, attempt
|
|
50
|
+
to obtain a replacement token using the configured credentials.
|
|
51
|
+
3. If renewal succeeds, retry the original request once with the replacement
|
|
52
|
+
token.
|
|
53
|
+
|
|
54
|
+
* If that retry fails, the application receives the error. The driver does
|
|
55
|
+
not renew the token or retry the request again.
|
|
56
|
+
|
|
57
|
+
4. If obtaining a replacement token fails, the original request is not retried.
|
|
58
|
+
The error from that renewal attempt is raised to the caller.
|
|
59
|
+
|
|
60
|
+
Both the HTTP status and ArangoDB error code must match to trigger renewal.
|
|
61
|
+
Other responses, including HTTP 403, do not trigger JWT renewal or an
|
|
62
|
+
authentication retry. For example, a rejected version request raises
|
|
63
|
+
:class:`arango.exceptions.ServerVersionError`.
|
|
64
|
+
|
|
65
|
+
HTTP 401/error code 11 does not prove that the token expired. The same renewal
|
|
66
|
+
and retry policy applies if the server rejects a locally unexpired token.
|
|
67
|
+
Renewal authenticates the same user and does not grant additional permissions;
|
|
68
|
+
if access is still denied, the retried request fails normally.
|
|
69
|
+
|
|
70
|
+
Renewal is reactive: it happens after a qualifying server rejection, not on a
|
|
71
|
+
timer or proactively before expiration. The driver does not fall back to Basic
|
|
72
|
+
authentication when JWT authentication fails.
|
|
73
|
+
|
|
74
|
+
Keep client and server clocks synchronized because the driver checks token
|
|
75
|
+
expiration when accepting a token.
|
|
76
|
+
|
|
77
|
+
**Example:**
|
|
78
|
+
|
|
79
|
+
.. testcode::
|
|
80
|
+
from arango import ArangoClient
|
|
81
|
+
|
|
82
|
+
# Initialize the ArangoDB client.
|
|
83
|
+
client = ArangoClient()
|
|
84
|
+
|
|
85
|
+
# Connect to "test" database as root user using JWT.
|
|
86
|
+
db = client.db(
|
|
87
|
+
'test',
|
|
88
|
+
username='root',
|
|
89
|
+
password='passwd',
|
|
90
|
+
auth_method='jwt'
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# Manually refresh the token.
|
|
94
|
+
db.conn.refresh_token()
|
|
95
|
+
|
|
96
|
+
Application-managed tokens
|
|
97
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
98
|
+
|
|
99
|
+
Use ``user_token`` or ``superuser_token`` to supply a token obtained outside
|
|
100
|
+
the driver. These tokens are not renewed automatically: the application is
|
|
101
|
+
responsible for obtaining replacements. Supplied username/password and
|
|
102
|
+
``auth_method`` are ignored when either token argument is used, so they cannot
|
|
103
|
+
provide renewal credentials for that connection.
|
|
104
|
+
|
|
105
|
+
``user_token`` is checked for expiration locally when the connection is
|
|
106
|
+
created. ``superuser_token`` is accepted without a local expiry check at
|
|
107
|
+
construction; the server can reject it on the first request. With
|
|
108
|
+
``verify=True``, that first request occurs during ``client.db()`` and a rejected
|
|
109
|
+
token causes :class:`arango.exceptions.ServerConnectionError`.
|
|
110
|
+
|
|
111
|
+
**Example:**
|
|
112
|
+
|
|
113
|
+
.. code-block:: python
|
|
114
|
+
|
|
115
|
+
from calendar import timegm
|
|
116
|
+
from datetime import datetime
|
|
117
|
+
|
|
118
|
+
import jwt
|
|
119
|
+
|
|
120
|
+
from arango import ArangoClient
|
|
121
|
+
|
|
122
|
+
# Initialize the ArangoDB client.
|
|
123
|
+
client = ArangoClient()
|
|
124
|
+
|
|
125
|
+
# Generate the JWT token manually.
|
|
126
|
+
now = timegm(datetime.utcnow().utctimetuple())
|
|
127
|
+
token = jwt.encode(
|
|
128
|
+
payload={
|
|
129
|
+
'iat': now,
|
|
130
|
+
'exp': now + 3600,
|
|
131
|
+
'iss': 'arangodb',
|
|
132
|
+
'server_id': 'client'
|
|
133
|
+
},
|
|
134
|
+
key='secret',
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# Connect to "test" database as superuser using the token.
|
|
138
|
+
db = client.db('test', superuser_token=token)
|
|
139
|
+
|
|
140
|
+
# Connect to "test" database as user using the token.
|
|
141
|
+
db = client.db('test', user_token=token)
|
|
142
|
+
|
|
143
|
+
Replace an application-managed token using ``db.conn.set_token(new_token)``.
|
|
144
|
+
This changes the token used by the database wrapper and existing collection
|
|
145
|
+
wrappers sharing its connection. Separate connections created by other
|
|
146
|
+
``client.db()`` calls are unaffected. For both user and superuser connections,
|
|
147
|
+
``set_token()`` checks expiration locally and raises
|
|
148
|
+
:class:`arango.exceptions.JWTExpiredError` if the replacement has expired.
|
|
149
|
+
|
|
150
|
+
**Example:**
|
|
151
|
+
|
|
152
|
+
.. code-block:: python
|
|
153
|
+
|
|
154
|
+
from arango import ArangoClient
|
|
155
|
+
|
|
156
|
+
# Initialize the ArangoDB client.
|
|
157
|
+
client = ArangoClient()
|
|
158
|
+
|
|
159
|
+
# Connect to "test" database as a user using the token.
|
|
160
|
+
db = client.db('test', user_token='token')
|
|
161
|
+
|
|
162
|
+
# Set the user token on the connection object.
|
|
163
|
+
db.conn.set_token('new token')
|
|
164
|
+
|
|
165
|
+
# Connect to "test" database as superuser using the token.
|
|
166
|
+
db = client.db('test', superuser_token='superuser token')
|
|
167
|
+
|
|
168
|
+
# Set the user token on the connection object.
|
|
169
|
+
db.conn.set_token('new superuser token')
|
|
@@ -40,6 +40,37 @@ For more information, refer to `ArangoDB manual`_.
|
|
|
40
40
|
# Delete the graph.
|
|
41
41
|
db.delete_graph('school')
|
|
42
42
|
|
|
43
|
+
Graph creation options
|
|
44
|
+
======================
|
|
45
|
+
|
|
46
|
+
To create an EnterpriseGraph, pass ``smart=True`` and omit ``smart_field``.
|
|
47
|
+
EnterpriseGraphs use optimized graph sharding without a user-defined smart
|
|
48
|
+
field.
|
|
49
|
+
|
|
50
|
+
To create a SmartGraph, set ``smart_field`` to the vertex attribute used for
|
|
51
|
+
sharding (``smart=True`` is then optional).Set ``disjoint=True`` alongside
|
|
52
|
+
``smart_field`` to create a Disjoint SmartGraph, which rejects edges between
|
|
53
|
+
vertices with different smart field values.
|
|
54
|
+
|
|
55
|
+
For example, on an enterprise cluster:
|
|
56
|
+
|
|
57
|
+
.. code-block:: python
|
|
58
|
+
|
|
59
|
+
regional = db.create_graph(
|
|
60
|
+
'regional',
|
|
61
|
+
edge_definitions=[{
|
|
62
|
+
'edge_collection': 'routes',
|
|
63
|
+
'from_vertex_collections': ['places'],
|
|
64
|
+
'to_vertex_collections': ['places'],
|
|
65
|
+
}],
|
|
66
|
+
smart_field='region',
|
|
67
|
+
disjoint=True,
|
|
68
|
+
shard_count=3,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
See :meth:`arango.database.StandardDatabase.create_graph` for all creation
|
|
72
|
+
options.
|
|
73
|
+
|
|
43
74
|
.. _edge-definitions:
|
|
44
75
|
|
|
45
76
|
Edge Definitions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-arango
|
|
3
|
-
Version: 8.3.
|
|
3
|
+
Version: 8.3.8
|
|
4
4
|
Summary: Python Driver for ArangoDB
|
|
5
5
|
Author-email: Joohwan Oh <joohwan.oh@outlook.com>
|
|
6
6
|
Maintainer-email: Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "8.3.6"
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
Authentication
|
|
2
|
-
--------------
|
|
3
|
-
|
|
4
|
-
Python-arango supports two HTTP authentication methods: basic and JSON Web
|
|
5
|
-
Tokens (JWT).
|
|
6
|
-
|
|
7
|
-
Basic Authentication
|
|
8
|
-
====================
|
|
9
|
-
|
|
10
|
-
This is python-arango's default authentication method.
|
|
11
|
-
|
|
12
|
-
**Example:**
|
|
13
|
-
|
|
14
|
-
.. testcode::
|
|
15
|
-
from arango import ArangoClient
|
|
16
|
-
|
|
17
|
-
# Initialize the ArangoDB client.
|
|
18
|
-
client = ArangoClient()
|
|
19
|
-
|
|
20
|
-
# Connect to "test" database as root user using basic auth.
|
|
21
|
-
db = client.db('test', username='root', password='passwd')
|
|
22
|
-
|
|
23
|
-
# The authentication method can be given explicitly.
|
|
24
|
-
db = client.db(
|
|
25
|
-
'test',
|
|
26
|
-
username='root',
|
|
27
|
-
password='passwd',
|
|
28
|
-
auth_method='basic'
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
JSON Web Tokens (JWT)
|
|
32
|
-
=====================
|
|
33
|
-
|
|
34
|
-
Python-arango automatically obtains JSON web tokens from the server using
|
|
35
|
-
username and password. It also refreshes expired tokens and retries requests.
|
|
36
|
-
The client and server clocks must be synchronized for the automatic refresh
|
|
37
|
-
to work correctly.
|
|
38
|
-
|
|
39
|
-
**Example:**
|
|
40
|
-
|
|
41
|
-
.. testcode::
|
|
42
|
-
from arango import ArangoClient
|
|
43
|
-
|
|
44
|
-
# Initialize the ArangoDB client.
|
|
45
|
-
client = ArangoClient()
|
|
46
|
-
|
|
47
|
-
# Connect to "test" database as root user using JWT.
|
|
48
|
-
db = client.db(
|
|
49
|
-
'test',
|
|
50
|
-
username='root',
|
|
51
|
-
password='passwd',
|
|
52
|
-
auth_method='jwt'
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
# Manually refresh the token.
|
|
56
|
-
db.conn.refresh_token()
|
|
57
|
-
|
|
58
|
-
# Override the token expiry compare leeway in seconds (default: 0) to
|
|
59
|
-
# compensate for out-of-sync clocks between the client and server.
|
|
60
|
-
db.conn.ext_leeway = 2
|
|
61
|
-
|
|
62
|
-
User generated JWT token can be used for user and superuser access.
|
|
63
|
-
|
|
64
|
-
**Example:**
|
|
65
|
-
|
|
66
|
-
.. code-block:: python
|
|
67
|
-
|
|
68
|
-
from calendar import timegm
|
|
69
|
-
from datetime import datetime
|
|
70
|
-
|
|
71
|
-
import jwt
|
|
72
|
-
|
|
73
|
-
from arango import ArangoClient
|
|
74
|
-
|
|
75
|
-
# Initialize the ArangoDB client.
|
|
76
|
-
client = ArangoClient()
|
|
77
|
-
|
|
78
|
-
# Generate the JWT token manually.
|
|
79
|
-
now = timegm(datetime.utcnow().utctimetuple())
|
|
80
|
-
token = jwt.encode(
|
|
81
|
-
payload={
|
|
82
|
-
'iat': now,
|
|
83
|
-
'exp': now + 3600,
|
|
84
|
-
'iss': 'arangodb',
|
|
85
|
-
'server_id': 'client'
|
|
86
|
-
},
|
|
87
|
-
key='secret',
|
|
88
|
-
).decode('utf-8')
|
|
89
|
-
|
|
90
|
-
# Connect to "test" database as superuser using the token.
|
|
91
|
-
db = client.db('test', superuser_token=token)
|
|
92
|
-
|
|
93
|
-
# Connect to "test" database as user using the token.
|
|
94
|
-
db = client.db('test', user_token=token)
|
|
95
|
-
|
|
96
|
-
User and superuser tokens can be set on the connection object as well.
|
|
97
|
-
|
|
98
|
-
**Example:**
|
|
99
|
-
|
|
100
|
-
.. code-block:: python
|
|
101
|
-
|
|
102
|
-
from arango import ArangoClient
|
|
103
|
-
|
|
104
|
-
# Initialize the ArangoDB client.
|
|
105
|
-
client = ArangoClient()
|
|
106
|
-
|
|
107
|
-
# Connect to "test" database as superuser using the token.
|
|
108
|
-
db = client.db('test', user_token='token')
|
|
109
|
-
|
|
110
|
-
# Set the user token on the connection object.
|
|
111
|
-
db.conn.set_token('new token')
|
|
112
|
-
|
|
113
|
-
# Connect to "test" database as superuser using the token.
|
|
114
|
-
db = client.db('test', superuser_token='superuser token')
|
|
115
|
-
|
|
116
|
-
# Set the user token on the connection object.
|
|
117
|
-
db.conn.set_token('new superuser token')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|