From 47b7b096430489821abd641603ba61d5ee152292 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 21 Aug 2020 14:29:30 +0100 Subject: [PATCH] Fix #3 --- labthings_client/affordances.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/labthings_client/affordances.py b/labthings_client/affordances.py index 1f2d30b..8a291ff 100644 --- a/labthings_client/affordances.py +++ b/labthings_client/affordances.py @@ -47,16 +47,20 @@ def set(self, *args, **kwargs): return self.put(*args, **kwargs) def put(self, value): + if value is None: + value = {} if not self.read_only: - r = requests.put(self.self_url, json=value or {}) + r = requests.put(self.self_url, json=value) r.raise_for_status() return r.json() else: raise AttributeError("Can't set attribute, is read-only") def post(self, value): + if value is None: + value = {} if not self.read_only: - r = requests.post(self.self_url, json=value or {}) + r = requests.post(self.self_url, json=value) r.raise_for_status() return r.json() else: