marksull / fmcapi

A Python package designed to help users of Cisco's FMC interface with its API.
BSD 3-Clause "New" or "Revised" License
81 stars 57 forks source link

Issuing delete() on non-existent UUID results in traceback #24

Closed marksull closed 5 years ago

marksull commented 5 years ago

The error:

  File "/Users/marksull/Development/Python/fmcapi/fmcapi/api_objects.py", line 173, in delete
    self.parse_kwargs(**response)
TypeError: parse_kwargs() argument after ** must be a mapping, not NoneType

Caused by fmcapi.fmc.send_to_api returning a None on the exception:

        except requests.exceptions.HTTPError as err:
            logging.error("Error in POST operation --> {}".format(str(err)))
            logging.error("json_response -->\t{}".format(json_response))
            if response:
                response.close()
            return None

But then fmcapi.api_objects.delete() trying to expand the None in the response.

            self.parse_kwargs(**response)
daxm commented 5 years ago

Do you have suggestions on how to fix? Could I get the test you were doing so that I can try to replicate?

marksull commented 5 years ago

Resolved with #27