def recording_download( self, recording_id, filename=None, override=False, timeout=DEFAULT_VIDEO_DOWNLOAD_TIMEOUT, ): """Save a recording in MP4 format to a file or return raw.""" if not self.has_subscription: msg = "Your Ring account does not have an active subscription." _LOGGER.warning(msg) return False url = URL_RECORDING.format(recording_id) try: # Video download needs a longer timeout to get the large video file req = self._ring.query(url, timeout=timeout) if req and req.status_code == 200: if filename: if os.path.isfile(filename) and not override: _LOGGER.error("%s", FILE_EXISTS.format(filename)) return False with open(filename, "wb") as recording: recording.write(req.content) return True else: return req.content except IOError as error: _LOGGER.error("%s", error) raise return False
def recording_url(self, recording_id): """Return HTTPS recording URL.""" url = API_URI + URL_RECORDING.format(recording_id) req = self._ring.query(url, raw=True) if req.status_code == 200: return req.url return False
def recording_download(self, recording_id, filename=None, override=False): """Save a recording in MP4 format to a file or return raw.""" if not self.has_subscription: msg = "Your Ring account does not have an active subscription." _LOGGER.warning(msg) return False url = API_URI + URL_RECORDING.format(recording_id) try: req = self._ring.query(url, raw=True) if req and req.status_code == 200: if filename: if os.path.isfile(filename) and not override: _LOGGER.error("%s", FILE_EXISTS.format(filename)) return False with open(filename, 'wb') as recording: recording.write(req.content) return True else: return req.content except IOError as error: _LOGGER.error("%s", error) raise return False
def recording_url(self, recording_id): """Return HTTPS recording URL.""" url = API_URI + URL_RECORDING.format(recording_id) req = self._ring.query(url, raw=True) if req.status_code == 200: return req.url return False
def recording_url(self, recording_id): """Return HTTPS recording URL.""" if not self.has_subscription: msg = "Your Ring account does not have an active subscription." _LOGGER.warning(msg) return False url = URL_RECORDING.format(recording_id) req = self._ring.query(url) if req and req.status_code == 200: return req.url return False
def recording_download(self, recording_id, filename=None, override=False): """Save a recording in MP4 format to a file or return raw.""" url = API_URI + URL_RECORDING.format(recording_id) try: req = self._ring.query(url, raw=True) if req.status_code == 200: if filename: if os.path.isfile(filename) and not override: _LOGGER.error("%s", FILE_EXISTS.format(filename)) return False with open(filename, 'wb') as recording: recording.write(req.content) return True else: return req.content except IOError as error: _LOGGER.error("%s", error) raise
def recording_download(self, recording_id, filename=None, override=False): """Save a recording in MP4 format to a file or return raw.""" url = API_URI + URL_RECORDING.format(recording_id) try: req = self._ring.query(url, raw=True) if req.status_code == 200: if filename: if os.path.isfile(filename) and not override: _LOGGER.error("%s", FILE_EXISTS.format(filename)) return False with open(filename, 'wb') as recording: recording.write(req.content) return True else: return req.content except IOError as error: _LOGGER.error("%s", error) raise