Skip to content

Commit

Permalink
Merge pull request #224 from MerginMaps/cleanup-client-service
Browse files Browse the repository at this point in the history
Cleanup: Remove deprecated function and improve error handling
  • Loading branch information
MarcelGeo authored Dec 5, 2024
2 parents 70c48a9 + 2d521a1 commit 8716eec
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,41 +336,15 @@ 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,
if such exists in self.url server.
Returns response from server as JSON dict or None if endpoint is not found
"""

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

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

return response
resp = self.get(f"/v1/workspace/{workspace_id}/service")
return json.loads(resp)

def workspace_usage(self, workspace_id):
"""
Expand Down

0 comments on commit 8716eec

Please sign in to comment.