API

gremlinrestclient module

gremlinrestclient.client module

class gremlinrestclient.client.GremlinRestClient(url='http://localhost:8182')[source]

Bases: object

HEADERS = {'content-type': 'application/json'}
execute(gremlin, bindings=None, lang='gremlin-groovy', query_timeout=None)[source]

Send a script to the Gremlin Server

Parameters:
  • gremlin (str) – The script to send.
  • bindings (dict) – Bindings for the Gremlin Script.
  • lang (str) – Gremlin language variant.
Returns:

Response

class gremlinrestclient.client.Response(status_code, data, message, metadata)

Bases: tuple

count(value) → integer -- return number of occurrences of value
data

Alias for field number 1

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

message

Alias for field number 2

metadata

Alias for field number 3

status_code

Alias for field number 0

gremlinrestclient.graph module

class gremlinrestclient.graph.TitanGraph(url='http://localhost:8182')[source]

Bases: gremlinrestclient.graph.TinkerGraph

HEADERS = {'content-type': 'application/json'}
create(*elements)[source]
execute(gremlin, bindings=None, lang='gremlin-groovy', query_timeout=None)

Send a script to the Gremlin Server

Parameters:
  • gremlin (str) – The script to send.
  • bindings (dict) – Bindings for the Gremlin Script.
  • lang (str) – Gremlin language variant.
Returns:

Response

class gremlinrestclient.graph.TinkerGraph(url='http://localhost:8182')[source]

Bases: gremlinrestclient.client.GremlinRestClient, gremlinrestclient.graph.Graph

HEADERS = {'content-type': 'application/json'}
create(*elements)[source]
execute(gremlin, bindings=None, lang='gremlin-groovy', query_timeout=None)

Send a script to the Gremlin Server

Parameters:
  • gremlin (str) – The script to send.
  • bindings (dict) – Bindings for the Gremlin Script.
  • lang (str) – Gremlin language variant.
Returns:

Response

class gremlinrestclient.graph.Graph[source]

A script factory for the Gremlin Server that defines the common interface for the Tinkerpop3 backends.

create(*elements)[source]

Create nodes and edges.

Parameters:elements – Args can either be Vertex, dict that can be cast to a Vertex or a tuple that can be cast to an Edge.
class gremlinrestclient.graph.Vertex(id, label, properties)

Bases: tuple

count(value) → integer -- return number of occurrences of value
id

Alias for field number 0

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

label

Alias for field number 1

properties

Alias for field number 2

class gremlinrestclient.graph.Edge(id, source_id, label, target_id, properties)

Bases: tuple

count(value) → integer -- return number of occurrences of value
id

Alias for field number 0

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

label

Alias for field number 2

properties

Alias for field number 4

source_id

Alias for field number 1

target_id

Alias for field number 3

class gremlinrestclient.graph.Collection(vertices, edges)

Bases: tuple

count(value) → integer -- return number of occurrences of value
edges

Alias for field number 1

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

vertices

Alias for field number 0

gremlinrestclient.exceptions module

Gremlin Server exceptions.

exception gremlinrestclient.exceptions.RequestError(value, result)[source]

Bases: gremlinrestclient.exceptions.StatusException

exception gremlinrestclient.exceptions.GremlinServerError(value, result)[source]

Bases: gremlinrestclient.exceptions.StatusException