Skip to content

Commit 2541d44

Browse files
Update Pydgraph client to support login into namespace
1 parent 4c3d9e6 commit 2541d44

File tree

3 files changed

+45
-21
lines changed

3 files changed

+45
-21
lines changed

pydgraph/client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ def login(self, userid, password, timeout=None, metadata=None,
6868
login_req = api.LoginRequest()
6969
login_req.userid = userid
7070
login_req.password = password
71+
login_req.namespace = 0
72+
73+
response = self.any_client().login(login_req, timeout=timeout,
74+
metadata=metadata,
75+
credentials=credentials)
76+
self._jwt = api.Jwt()
77+
self._jwt.ParseFromString(response.json)
78+
self._login_metadata = [("accessjwt", self._jwt.access_jwt)]
79+
80+
def login_in_namespace(self, userid, password, namespace, timeout=None, metadata=None,
81+
credentials=None):
82+
login_req = api.LoginRequest()
83+
login_req.userid = userid
84+
login_req.password = password
85+
login_req.namespace = namespace
7186

7287
response = self.any_client().login(login_req, timeout=timeout,
7388
metadata=metadata,

pydgraph/proto/api.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ message Metrics {
150150
}
151151

152152
message NQuad {
153+
reserved 5; // This was used for label
153154
string subject = 1;
154155
string predicate = 2;
155156
string object_id = 3;
156157
Value object_value = 4;
157-
string label = 5;
158158
string lang = 6;
159159
repeated Facet facets = 7;
160+
uint64 namespace = 8;
160161
}
161162

162163
message Value {
@@ -195,6 +196,7 @@ message LoginRequest {
195196
string userid = 1;
196197
string password = 2;
197198
string refresh_token = 3;
199+
uint64 namespace = 4;
198200
}
199201

200202
message Jwt {

pydgraph/proto/api_pb2.py

Lines changed: 27 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)