Skip to content

chore: upgrade dependencies and python to 3.12 #76

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
Aug 13, 2024
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
169 changes: 0 additions & 169 deletions Pipfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion reolinkapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from reolinkapi.handlers.api_handler import APIHandler
from .camera import Camera

__version__ = "0.1.5"
__version__ = "0.2.0"
10 changes: 7 additions & 3 deletions reolinkapi/mixins/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ def get_snap(self, timeout: float = 3, proxies: Any = None) -> Optional[Image]:
except Exception as e:
print("Could not get Image data\n", e)
raise
except ImportError:
except ImportError as err:
print("ImportError", err)

class StreamAPIMixin:
""" API calls for opening a video stream or capturing an image from the camera."""

def open_video_stream(self, callback: Any = None, proxies: Any = None) -> Any:
raise ImportError('''open_video_stream requires streaming extra dependencies\nFor instance "pip install reolinkapi[streaming]"''')
raise ImportError(f'open_video_stream requires streaming extra dependencies\nFor instance "pip install '
f'reolinkapi[streaming]"')

def get_snap(self, timeout: float = 3, proxies: Any = None) -> Optional['Image']:
raise ImportError('''open_video_stream requires streaming extra dependencies\nFor instance "pip install reolinkapi[streaming]"''')
raise ImportError(
f'get_snap requires streaming extra dependencies\nFor instance "pip install reolinkapi[streaming]"')
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ def find_version(*file_paths):
AUTHOR = 'Benehiko'
LICENSE = 'GPL-3.0'
INSTALL_REQUIRES = [
'setuptools',
'PySocks==1.7.1',
'PyYaml==5.3.1',
'requests>=2.18.4',
'PyYaml==6.0.2',
'requests>=2.32.3',
]
EXTRAS_REQUIRE = {
'streaming': [
'numpy==1.19.4',
'opencv-python==4.4.0.46',
'Pillow==8.0.1',
'numpy==2.0.1',
'opencv-python==4.10.0.84',
'Pillow==10.4.0',
],
}

Expand All @@ -47,7 +48,7 @@ def find_version(*file_paths):

setup(
name=NAME,
python_requires='>=3.6.0',
python_requires='>=3.12.4',
version=find_version('reolinkapi', '__init__.py'),
description=DESCRIPTION,
long_description=long_description,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def test_camera(self):
self.assertTrue(self.cam.ip == self.config.get('camera', 'ip'))
self.assertTrue(self.cam.token != '')

def test_snapshot(self):
img = self.cam.get_snap()
# write Pillow Image to file
img.save('./tmp/snaps/camera.jpg')
self.assertTrue(os.path.exists('./tmp/snaps/camera.jpg'))


if __name__ == '__main__':
unittest.main()