unity-sds / unity-py

Apache License 2.0
2 stars 4 forks source link

[Bug] deploy_process should not convert a dict-like object to string before submission #71

Closed mike-gangl closed 5 months ago

mike-gangl commented 6 months ago

Checked for duplicates

Have you checked for duplicate issue tickets?

Yes - I've already checked

Describe the bug

When submitting a deploy request to the WPS-T server, we are double "string-a-fying" it at https://github.com/unity-sds/unity-py/blob/main/unity_sds_client/services/process_service.py#L132. BEcause we're using the json key in the requests library, this should be passed as a dict-like object not a json string.

see https://requests.readthedocs.io/en/latest/user/quickstart/#more-complicated-post-requests

If you need that header set and you don’t want to encode the dict yourself, you can also pass it directly using the json parameter (added in version 2.4.2) and it will be encoded automatically

What did you expect?

Expected a valid response from the WPS-T server, but got a 500 error due to the duplicate encoding.

Reproducible steps

for unity_sds_client < 0.2.2

f = open('workflowDescriptor.json')
data = json.load(f)
process_service.deploy_process(data)

where workflowDescriptor is available at https://github.com/unity-sds/sbg-workflows/tree/main/preprocess