Skip to content

Commit

Permalink
* Remove deprecated "user_service" function
Browse files Browse the repository at this point in the history
* Use ClientError syntax for "workspace_service"
  • Loading branch information
ValentinBuira committed Dec 3, 2024
1 parent 74222e4 commit 0850f43
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,24 +336,6 @@ def username(self):
return None # not authenticated
return self._user_info["username"]

def user_service(self):
"""
Requests information about user from /user/service endpoint if such exists in self.url server.
Returns response from server as JSON dict or None if endpoint is not found
This can be removed once our SaaS server is upgraded to support workspaces
"""

try:
response = self.get("/v1/user/service")
except ClientError as e:
self.log.debug("Unable to query for /user/service endpoint")
return

response = json.loads(response.read())

return response

def workspace_service(self, workspace_id):
"""
This Requests information about a workspace service from /workspace/{id}/service endpoint,
Expand All @@ -365,8 +347,8 @@ def workspace_service(self, workspace_id):
try:
response = self.get(f"/v1/workspace/{workspace_id}/service")
except ClientError as e:
self.log.debug(f"Unable to query for /workspace/{workspace_id}/service endpoint")
return
e.extra = f"Unable to query for /workspace/{workspace_id}/service endpoint"
raise e

response = json.loads(response.read())

Expand Down

0 comments on commit 0850f43

Please sign in to comment.