Skip to content

Commit d02c71d

Browse files
committed
add call to /user/service endpoint
1 parent 3b969df commit d02c71d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mergin/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,23 @@ def username(self):
306306
return None # not authenticated
307307
return self._user_info["username"]
308308

309+
def user_service(self):
310+
"""
311+
Requests information about user from /user/service endpoint if such exists in self.url server.
312+
313+
Returns response from server as JSON dict or None if endpoint is not found
314+
"""
315+
316+
try:
317+
response = self.get("/v1/user/service")
318+
except ClientError as e:
319+
self.log.debug("Unable to query for /user/service endpoint")
320+
return
321+
322+
response = json.loads(response.read())
323+
324+
return response
325+
309326
def create_project(self, project_name, is_public=False, namespace=None):
310327
"""
311328
Create new project repository in user namespace on Mergin server.

0 commit comments

Comments
 (0)