When attempting to create a Saved Query by passing in a dict representing the query attributes, the SDK fails unless one passes that dict as a json-formatted str. This differs from other parts of the SDK like add_event(). The solution is to do as KeenApi.post_events() does and call json.dumps() to format the dict properly for a PUT body before passing it as the data argument to fulfill(): https://github.com/keenlabs/KeenClient-Python/blob/master/keen/saved_queries.py#L68
...
...
File "C:\Python27\lib\site-packages\keen\saved_queries.py", line 70, in create
keen_api._error_handling(response)
File "C:\Python27\lib\site-packages\keen\api.py", line 219, in _error_handling
raise exceptions.KeenApiError(error)
keen.exceptions.KeenApiError: Error from Keen API. Details:
Message: The specified JSON is invalid. No JSON object could be decoded
Code: InvalidJSONError
When attempting to create a Saved Query by passing in a dict representing the query attributes, the SDK fails unless one passes that dict as a json-formatted str. This differs from other parts of the SDK like
add_event()
. The solution is to do asKeenApi.post_events()
does and calljson.dumps()
to format the dict properly for a PUT body before passing it as thedata
argument tofulfill()
: https://github.com/keenlabs/KeenClient-Python/blob/master/keen/saved_queries.py#L68Repro steps:
Expected result:
Actual result: