0 Replies Latest reply on Nov 6, 2017 4:39 PM by toanngo

    Python API notificant.py inconsistency with other API calls.

    toanngo Lurker

      Wavefront python API could use much better documentation.  I'm testing a search for notificants.  I run into an error with the API call search_api.search_notificant_entities.

       

          _return_http_data_only, collection_formats, _preload_content, _request_timeout)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 163, in __call_api

          return_data = self.deserialize(response_data, response_type)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 236, in deserialize

          return self.__deserialize(data, response_type)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 276, in __deserialize

          return self.__deserialize_model(data, klass)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 620, in __deserialize_model

          kwargs[attr] = self.__deserialize(value, attr_type)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 276, in __deserialize

          return self.__deserialize_model(data, klass)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 620, in __deserialize_model

          kwargs[attr] = self.__deserialize(value, attr_type)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 254, in __deserialize

          for sub_data in data]

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 254, in <listcomp>

          for sub_data in data]

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 276, in __deserialize

          return self.__deserialize_model(data, klass)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/api_client.py", line 622, in __deserialize_model

          instance = klass(**kwargs)

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/models/notificant.py", line 93, in __init__

          self.content_type = content_type

        File "/usr/local/lib/python3.6/site-packages/wavefront_api_client/models/notificant.py", line 171, in content_type

          .format(content_type, allowed_values)

      ValueError: Invalid value for `content_type` (), must be one of ['application/json', 'text/html', 'text/plain', 'application/x-www-form-urlencoded']

       

      Is there a way for configure more headers for the client connection?  search_api.search_dashboard_entities and search_api.search_alert_entities doesn't complain about unset content_type.  api_client.py also sets content_type to application/json by default.  I worked around this by removing the error for unset content_type in notificant.py.

      :::