N4S4 / synology-api

A Python wrapper around Synology API
MIT License
384 stars 142 forks source link

Machine oriented outputs for async start function #107

Closed fcouziniedevy closed 1 year ago

fcouziniedevy commented 1 year ago

We are using the FileStation API and this package is really helpful but it is a bit annoying to use for the asyn requests in a fully automatic mode. Usually our workflow is the following:

The parsing could be easily prevented if the output of the "start" method was the task_id directly. If it seems ok with you, I am willing to do a PR where depending on an option in FileStation (or in the methods) the output is directly the task_id. This option would be set by default to False to keep backward compatibility.

This would lead to the following code (not sure about the parameter name):

fs = FileStation(..., dict_output=False) # default
res = fs.start_search(...)
# res is a str with the current message  "You can now ..."

fs = FileStation(..., dict_output=True)
res = fs.start_search(...)
# res is of the form {"message": "'You can now ...", "task_id": 35000}

If that sounds ok with you, I can submit a PR soon.

N4S4 commented 1 year ago

hello,

yes you can PR I will test and review.

thank you for the support!

N4S4 commented 1 year ago

Closed with PR #110