py-august
py-august copied to clipboard
feat: add ability to set user pin codes and fix bug with fetching pin codes
Summary
As part of managing a vacation rental I wanted the ability to programmatically set august lock pin codes. Thanks to the APIs documented here https://github.com/jmaxxz/keymaker/blob/master/postman/august.postman_collection.json I was able to implement this.
First we need to perform an update pin operation and then we need to sync the pins to the lock.
Changes
-
Add new api method (
set_pin_for_user
) which performs both the update and the sync -
Fix a bug in pin.py I was hitting when initially calling
get_pins()
due to a missing key. To do this we switch from direct dictionary access to using.get()
py-august/august/pin.py:20, in Pin.__init__(self, data) 18 self._updated_at = data["updatedAt"] 19 self._loaded_date = data["loadedDate"] ---> 20 self._access_start_time = data["accessStartTime"] 21 self._access_end_time = data["accessEndTime"] 22 self._access_times = data["accessTimes"] KeyError: 'accessStartTime'