Skip to content
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

Adjust to new version of SumoClient #239

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/fmu/sumo/explorer/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_permissions(self, asset: str = None):
Returns:
dict: Dictionary of user permissions
"""
res = self._sumo.get("/userpermissions")
res = self._sumo.get("/userpermissions").json()

if asset is not None:
if asset not in res:
Expand All @@ -97,6 +97,7 @@ async def get_permissions_async(self, asset: str = None):
dict: Dictionary of user permissions
"""
res = await self._sumo.get_async("/userpermissions")
res = res.json()

if asset is not None:
if asset not in res:
Expand Down
4 changes: 2 additions & 2 deletions src/fmu/sumo/explorer/objects/_child.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def blob(self) -> BytesIO:
"""Object blob"""
if self._blob is None:
res = self._sumo.get(f"/objects('{self.uuid}')/blob")
self._blob = BytesIO(res)
self._blob = BytesIO(res.content)

return self._blob

Expand All @@ -87,6 +87,6 @@ async def blob_async(self) -> BytesIO:
"""Object blob"""
if self._blob is None:
res = await self._sumo.get_async(f"/objects('{self.uuid}')/blob")
self._blob = BytesIO(res)
self._blob = BytesIO(res.content)

return self._blob
8 changes: 4 additions & 4 deletions src/fmu/sumo/explorer/objects/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ def __init__(self, sumo: SumoClient, metadata: Dict) -> None:
def _populate_url(self):
res = self._sumo.get(f"/objects('{self.uuid}')/blob/authuri")
try:
res = json.loads(res.decode("UTF-8"))
res = res.json()
self._url = res.get("baseuri") + self.uuid
self._sas = res.get("auth")
except Exception:
self._url = res.decode("UTF-8")
self._url = res.content.decode("UTF-8")
adnejacobsen marked this conversation as resolved.
Show resolved Hide resolved

async def _populate_url_async(self):
res = await self._sumo.get_async(
f"/objects('{self.uuid}')/blob/authuri"
)
try:
res = json.loads(res.decode("UTF-8"))
res = res.json()
self._url = res.get("baseuri") + self.uuid
self._sas = res.get("auth")
except Exception:
self._url = res.decode("UTF-8")
self._url = res.content.decode("UTF-8")
adnejacobsen marked this conversation as resolved.
Show resolved Hide resolved

@property
def url(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/fmu/sumo/explorer/objects/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def blob(self) -> bytes:
"""Object blob"""
if self._blob is None:
res = self._sumo.get(f"/objects('{self.uuid}')/blob")
self._blob = res
self._blob = res.content

return self._blob

Expand Down
Loading