From 8ab44041ebfdc701e14184d2ba0d9113ffbcf964 Mon Sep 17 00:00:00 2001 From: Kevin Fronczak Date: Sat, 20 Jan 2018 20:13:33 -0500 Subject: [PATCH] Added ability to download recent video clip --- CHANGES.rst | 1 + blinkpy/blinkpy.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 768eb1f..42dedd7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,7 @@ A list of changes between each release - Refactored code for better organization - Moved some request calls out of @property methods (enables future CLI support) - Renamed get_summary() method to summary and changed to @property +- Added ability to download most recent video clip 0.6.0 (2017-05-12) ^^^^^^^^^^^^^^^^^^ diff --git a/blinkpy/blinkpy.py b/blinkpy/blinkpy.py index 631f366..582d692 100644 --- a/blinkpy/blinkpy.py +++ b/blinkpy/blinkpy.py @@ -178,6 +178,13 @@ class BlinkCamera(object): with open(path, 'wb') as imgfile: copyfileobj(response.raw, imgfile) + def video_to_file(self, path): + """Write video to file.""" + response = _request(self.blink, url=self.clip, headers=self.header, + reqtype='get', stream=True, json_resp=False) + with open(path, 'wb') as vidfile: + copyfileobj(response.raw, vidfile) + class Blink(object): """Class to initialize communication and sync module."""