atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.37k stars 664 forks source link

log_curl_debug messages convey misleading data payloads #590

Open jason-matthew opened 4 years ago

jason-matthew commented 4 years ago

json.dumps() is leveraged twice prior to writing the request's data payload.

  1. https://github.com/atlassian-api/atlassian-python-api/blob/09ff44afe0b7251dde3ed94da3155f97507129b7/atlassian/rest_client.py#L160
  2. https://github.com/atlassian-api/atlassian-python-api/blob/09ff44afe0b7251dde3ed94da3155f97507129b7/atlassian/rest_client.py#L119

Logging statements are not accurate curl statements. Note double quotes are being escaped. 2020-09-16 12:15:10,429 DEBUG curl --silent -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' --data '"{\"body\": {\"storage\": {\"representation\": \"storage\",

Using these curl statements complicates atlassian-python-api debugging given API responses convey a different error from what occurred during python execution {"statusCode":400,"message":"Can not instantiate value of type [simple type, class com.atlassian.confluence.api.model.content.Content] from JSON String; no single-String constructor/factory method","reason":"Bad Request"}

eli-halych commented 2 years ago

curl --silent is another problem - it mutes error messages, which doesn't make sense if you want to debug since you definitely want to see them