Updated project structure and some file names.

Restored `requirements.txt`

Updated `setup.py` to include new repository url and contact details.

Moved the rtsp code from `record` to `stream`.

Updated project structure to make it more readable and developer friendly - moved mixins to the `mixins` package, moved handlers to the `handlers` package.

Moved files not belonging to anything in particular to the `util` package.

Updated `camera` class to also defer login call.

Deleted unused files like `config_handler`.
This commit is contained in:
Alano Terblanche
2020-12-19 19:55:12 +02:00
parent 4c4dd7dd69
commit 2b3e142fe5
27 changed files with 117 additions and 95 deletions

View File

@@ -1,19 +1,31 @@
from .api_handler import APIHandler
from reolinkapi.handlers.api_handler import APIHandler
class Camera(APIHandler):
def __init__(self, ip: str, username: str = "admin", password: str = "", https: bool = False):
def __init__(self, ip: str,
username: str = "admin",
password: str = "",
https: bool = False,
defer_login: bool = False,
**kwargs):
"""
Initialise the Camera object by passing the ip address.
The default details {"username":"admin", "password":""} will be used if nothing passed
For deferring the login to the camera, just pass defer_login = True.
For connecting to the camera behind a proxy pass a proxy argument: proxy={"http": "socks5://127.0.0.1:8000"}
:param ip:
:param username:
:param password:
:param https: connect to the camera over https
:param defer_login: defer the login process
:param proxy: Add a proxy dict for requests to consume.
eg: {"http":"socks5://[username]:[password]@[host]:[port], "https": ...}
More information on proxies in requests: https://stackoverflow.com/a/15661226/9313679
"""
# For when you need to connect to a camera behind a proxy, pass
# a proxy argument: proxy={"http": "socks5://127.0.0.1:8000"}
APIHandler.__init__(self, ip, username, password, https=https)
APIHandler.__init__(self, ip, username, password, https=https, **kwargs)
# Normal call without proxy:
# APIHandler.__init__(self, ip, username, password)
@@ -21,4 +33,6 @@ class Camera(APIHandler):
self.ip = ip
self.username = username
self.password = password
super().login()
if not defer_login:
super().login()