Skip to content

Cleanup: Remove deprecated function and improve error handling #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 server_type(self):
"""
Expand Down
Loading