Closed cdot65 closed 2 weeks ago
The update method is trying to validate the response from the API, which may or may not be empty.
In [22]: update_address = addresses.fetch(folder='Texas', name='webserver network') In [23]: update_address Out[23]: {'name': 'webserver network', 'ip_netmask': '192.168.1.0/24', 'description': 'Internal network segment', 'tag': ['Python', 'Automation'], 'folder': 'Texas', 'id': '8d166508-594f-4b1c-867e-33655e09bf4d'} In [24]: update_address['name'] = 'webserver_network' In [25]: addresses.update(update_address) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[25], line 1 ----> 1 addresses.update(update_address) File ~/development/cdot65/pan-scm-sdk/scm/config/objects/address.py:83, in Address.update(self, data) 81 endpoint = f"{self.ENDPOINT}/{data['id']}" 82 response = self.api_client.put(endpoint, json=payload) ---> 83 return AddressResponseModel(**response) 84 except Exception as e: 85 if hasattr(e, "response") and e.response is not None: # noqa TypeError: scm.models.objects.address.AddressResponseModel() argument after ** must be a mapping, not NoneType
Recommendation is to allow for scenarios where the return value is empty.
This has been resolved in #26
The update method is trying to validate the response from the API, which may or may not be empty.
Recommendation is to allow for scenarios where the return value is empty.