imbajin commented on code in PR #483:
URL: https://github.com/apache/hugegraph-doc/pull/483#discussion_r3943357230


##########
content/en/docs/quickstart/client/hugegraph-client-python.md:
##########
@@ -99,6 +228,140 @@ result = gremlin.exec("g.V().limit(5)")
 print(result)
 ```
 
+`exec` binds the `graph` and `g` aliases for you, based on the graph name and 
the resolved GraphSpace, and returns the `result` field of the server response. 
A response missing `requestId`, `status` or `result` raises 
`ResponseParseError`.
+
+### Traverse the Graph
+
+`TraverserManager` wraps the server traverser endpoints. Its methods use 
snake_case.
+
+```python
+traverser = client.traverser()
+
+traverser.k_out(marko_id, 2)
+traverser.k_neighbor(marko_id, 2)
+traverser.same_neighbors(marko_id, josh_id)
+traverser.jaccard_similarity(marko_id, josh_id)
+traverser.shortest_path(marko_id, ripple_id, 3)
+traverser.all_shortest_paths(marko_id, ripple_id, 3)
+traverser.weighted_shortest_path(marko_id, ripple_id, "weight", 3)
+traverser.single_source_shortest_path(marko_id, 2)
+traverser.multi_node_shortest_path([marko_id, josh_id], max_depth=2)
+traverser.paths(marko_id, josh_id, 2)
+traverser.crosspoints(marko_id, josh_id, 2)
+traverser.rings(marko_id, 3)
+traverser.rays(marko_id, 2)
+traverser.vertices(marko_id)
+traverser.edges(edge_id)
+```
+
+The POST-based variants take request bodies: `advanced_paths`, 
`customized_paths`, `template_paths`, `customized_crosspoints` and 
`fusiform_similarity`.
+
+### Graph Variables
+
+```python
+variable = client.variable()
+variable.set("owner", "mary")
+print(variable.get("owner"))
+print(variable.all())
+variable.remove("owner")
+```
+
+### Async Tasks
+
+```python
+task = client.task()
+print(task.list_tasks(status="success", limit=10))
+print(task.get_task(task_id))
+task.cancel_task(task_id)
+task.delete_task(task_id)
+```
+
+### Server Metrics and Graph Info
+
+```python
+metrics = client.metrics()
+metrics.get_all_basic_metrics()
+metrics.get_gauges_metrics()
+metrics.get_counters_metrics()
+metrics.get_histograms_metrics()

Review Comment:
   ⚠️ The new histograms example currently calls an accessor whose 
implementation is wired to the gauges endpoint: get_histograms_metrics is 
decorated with GET /metrics/gauges (apache/hugegraph-ai@5ee21cc, 
hugegraph-python-client/src/pyhugegraph/api/metric.py:35-37). Please fix the 
upstream endpoint before documenting it as a histogram getter, or label/omit 
this entry so users do not receive gauge data under a histogram API.



##########
content/en/docs/quickstart/client/hugegraph-client-python.md:
##########
@@ -99,6 +228,140 @@ result = gremlin.exec("g.V().limit(5)")
 print(result)
 ```
 
+`exec` binds the `graph` and `g` aliases for you, based on the graph name and 
the resolved GraphSpace, and returns the `result` field of the server response. 
A response missing `requestId`, `status` or `result` raises 
`ResponseParseError`.
+
+### Traverse the Graph
+
+`TraverserManager` wraps the server traverser endpoints. Its methods use 
snake_case.
+
+```python
+traverser = client.traverser()
+
+traverser.k_out(marko_id, 2)
+traverser.k_neighbor(marko_id, 2)
+traverser.same_neighbors(marko_id, josh_id)
+traverser.jaccard_similarity(marko_id, josh_id)
+traverser.shortest_path(marko_id, ripple_id, 3)
+traverser.all_shortest_paths(marko_id, ripple_id, 3)
+traverser.weighted_shortest_path(marko_id, ripple_id, "weight", 3)
+traverser.single_source_shortest_path(marko_id, 2)
+traverser.multi_node_shortest_path([marko_id, josh_id], max_depth=2)
+traverser.paths(marko_id, josh_id, 2)
+traverser.crosspoints(marko_id, josh_id, 2)
+traverser.rings(marko_id, 3)
+traverser.rays(marko_id, 2)
+traverser.vertices(marko_id)
+traverser.edges(edge_id)
+```
+
+The POST-based variants take request bodies: `advanced_paths`, 
`customized_paths`, `template_paths`, `customized_crosspoints` and 
`fusiform_similarity`.
+
+### Graph Variables
+
+```python
+variable = client.variable()
+variable.set("owner", "mary")
+print(variable.get("owner"))
+print(variable.all())
+variable.remove("owner")
+```
+
+### Async Tasks
+
+```python
+task = client.task()
+print(task.list_tasks(status="success", limit=10))
+print(task.get_task(task_id))
+task.cancel_task(task_id)
+task.delete_task(task_id)
+```
+
+### Server Metrics and Graph Info
+
+```python
+metrics = client.metrics()
+metrics.get_all_basic_metrics()
+metrics.get_gauges_metrics()
+metrics.get_counters_metrics()
+metrics.get_histograms_metrics()
+metrics.get_meters_metrics()
+metrics.get_timers_metrics()
+metrics.get_statistics_metrics()
+metrics.get_system_metrics()
+metrics.get_backend_metrics()
+
+graphs = client.graphs()
+graphs.get_all_graphs()
+graphs.get_version()
+graphs.get_graph_info()
+graphs.get_graph_config()
+graphs.clear_graph_all_data()   # deletes every vertex, edge and schema entry
+
+print(client.version().version())
+```
+
+### Authentication and Authorization
+
+`AuthManager` follows the server routing: users, targets, belongs and accesses 
are mounted under `/graphspaces/{graphspace}/auth/...`, while groups stay at 
the server-level `/auth/groups`. On HugeGraph 1.7.0 and later a graphspace must 
be resolved, otherwise these calls raise `ValueError` before any request is 
sent.

Review Comment:
   🧹 The sentence "otherwise these calls raise ValueError" also reads as 
covering the server-level group methods named immediately before it, but 
/auth/groups does not require a graphspace (apache/hugegraph-ai@5ee21cc, 
hugegraph-python-client/src/pyhugegraph/api/auth.py:83-110). Please scope the 
ValueError statement to the graphspace-scoped user, target, belong, and access 
endpoints.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to