From 2c50a157ee852cc8a83669c4468c54ae3a45f885 Mon Sep 17 00:00:00 2001 From: amitay87 Date: Thu, 14 Mar 2019 23:26:00 +0200 Subject: [PATCH] added eqivalent method to dict get method - the dict get method was override by another get method (similar to GET request). Hence, I added the get_field method. - also added __dict__() method which converts the object to a regular dict --- clearbit/resource.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clearbit/resource.py b/clearbit/resource.py index 3b7688a..64960fb 100644 --- a/clearbit/resource.py +++ b/clearbit/resource.py @@ -76,3 +76,13 @@ def delete(cls, url, **values): response.raise_for_status() return response + + def get_field(self, field, default): + return self.__dict__().get(field, default) + + def __dict__(self): + resource_dict = {} + for key, value in self.items(): + resource_dict[key] = value + return resource_dict +