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

Fix cameras not reading data as bytes #233

Merged
merged 3 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/synology_dsm/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
"""Synology API models."""

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from synology_dsm import SynologyDSM


class SynoBaseApi:
"""Base api class."""

def __init__(self, dsm):
def __init__(self, dsm: "SynologyDSM") -> None:
Copy link
Owner

@mib1185 mib1185 Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhhh ... very nice 👍 with this i can continue with #183

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it because I was doing some right clicking and following the code, and it made it a lot easier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to make it a relative import in the future, but probably fine either way for now

"""Constructor method."""
self._dsm = dsm
self._data = {}
3 changes: 3 additions & 0 deletions src/synology_dsm/synology_dsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ async def _execute_request(self, method: str, url: str, params: dict, **kwargs):
]:
return await response.json(content_type=content_type)

if content_type.startswith("image"):
return await response.read()

return await response.text()

# We got a 400, 401 or 404 ...
Expand Down