Merge pull request #46 from axlan/streaming-dependancy-extra
Move streaming dependencies to their own "extra"
This commit is contained in:
@@ -49,6 +49,10 @@ Install from GitHub
|
||||
|
||||
pip install git+https://github.com/ReolinkCameraAPI/reolinkapipy.git
|
||||
|
||||
If you want to include the video streaming functionality you need to include the streaming "extra" dependencies
|
||||
|
||||
pip install 'reolinkapi[streaming]'
|
||||
|
||||
## Contributors
|
||||
|
||||
---
|
||||
|
||||
@@ -5,12 +5,14 @@ from urllib import parse
|
||||
from io import BytesIO
|
||||
|
||||
import requests
|
||||
from PIL.Image import Image, open as open_image
|
||||
|
||||
from reolinkapi.utils.rtsp_client import RtspClient
|
||||
try:
|
||||
from PIL.Image import Image, open as open_image
|
||||
|
||||
from reolinkapi.utils.rtsp_client import RtspClient
|
||||
|
||||
|
||||
class StreamAPIMixin:
|
||||
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:
|
||||
@@ -50,3 +52,12 @@ class StreamAPIMixin:
|
||||
except Exception as e:
|
||||
print("Could not get Image data\n", e)
|
||||
raise
|
||||
except ImportError:
|
||||
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]"''')
|
||||
|
||||
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]"''')
|
||||
|
||||
13
setup.py
13
setup.py
@@ -26,13 +26,17 @@ AUTHOR_EMAIL = 'alanoterblanche@gmail.com'
|
||||
AUTHOR = 'Benehiko'
|
||||
LICENSE = 'GPL-3.0'
|
||||
INSTALL_REQUIRES = [
|
||||
'numpy==1.19.4',
|
||||
'opencv-python==4.4.0.46',
|
||||
'Pillow==8.0.1',
|
||||
'PySocks==1.7.1',
|
||||
'PyYaml==5.3.1',
|
||||
'requests>=2.18.4',
|
||||
]
|
||||
EXTRAS_REQUIRE = {
|
||||
'streaming': [
|
||||
'numpy==1.19.4',
|
||||
'opencv-python==4.4.0.46',
|
||||
'Pillow==8.0.1',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
@@ -53,5 +57,6 @@ setup(
|
||||
url=URL,
|
||||
license=LICENSE,
|
||||
install_requires=INSTALL_REQUIRES,
|
||||
packages=find_packages(exclude=['examples', 'tests'])
|
||||
packages=find_packages(exclude=['examples', 'tests']),
|
||||
extras_require=EXTRAS_REQUIRE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user