Beispiel #1
0
    def last_image_from_cache(self):
        """
        Return last thumbnail present in self._cached_images.

        This is useful in Home Assistant when the ArloHub has not
        updated all information, but the camera.arlo already pulled
        the last image. Using this method, everything is kept synced.
        """
        if self.last_video:
            return http_get(self.last_video.thumbnail_url)
        return None
Beispiel #2
0
    def download_video(self, filename=None):
        """Download video content.

        :param filename: File to save video. Default: stdout
        """
        return http_get(self.video_url, filename)
Beispiel #3
0
    def download_thumbnail(self, filename=None):
        """Download JPEG thumbnail.

        :param filename: File to save thumbnail. Default: stdout
        """
        return http_get(self.thumbnail_url, filename)
Beispiel #4
0
 def last_image(self):
     """Return last image capture by camera."""
     return http_get(self._attrs.get('presignedLastImageUrl'))
Beispiel #5
0
    def test_http_get_with_filename(self, mock, mock_open):
        """Test http_get with filename."""
        from pyarlo.utils import http_get

        mock.get(DEVICES_ENDPOINT, text=load_fixture('pyarlo_devices.json'))
        self.assertTrue(http_get(DEVICES_ENDPOINT, filename=TEST_FILE))
Beispiel #6
0
    def test_http_get_ok_200(self, mock):
        """Test http_get with code 200."""
        from pyarlo.utils import http_get

        mock.get(DEVICES_ENDPOINT, json=MOCK_DATA)
        self.assertIsInstance(http_get(DEVICES_ENDPOINT), bytes)
Beispiel #7
0
    def test_http_get_errno_500(self, mock):
        """Test http_get with error 500."""
        from pyarlo.utils import http_get

        mock.get(DEVICES_ENDPOINT, json=MOCK_DATA, status_code=204)
        self.assertFalse(http_get(DEVICES_ENDPOINT))
Beispiel #8
0
 def last_image(self):
     """Return last image captured by camera."""
     if self._attrs is not None:
         return http_get(self._attrs.get('presignedLastImageUrl'))
     return None