Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
243 stars 76 forks source link

Handle plain text response types so json values are correctly returned #358

Open michaelarnauts opened 3 weeks ago

michaelarnauts commented 3 weeks ago

This change adds support for returning the actual string as it is returned by NiFi when the return type is set to str.

This fixes the exportTemplate, exportFlowVersion and exportProcessGroup API's and probably some others.

The current implementation would json.loads() the reply to a dict, and then convert that dict to a str by using str(). This doesn't generate a valid JSON however, since it will be the Python representation of a dict.

Actual returned JSON:

{"flowContents":{"identifier":"a9a4cae3-72e5-33c8-b6be-7879e79e5ded","instanceIdentifier":"2f968272-0190-1000-9f4a-82702...

Returned JSON after (wrongful) deserialisation:

{'flowContents': {'identifier': 'a9a4cae3-72e5-33c8-b6be-7879e79e5ded', 'instance...

Fixes #354