My.Jdownloader-API-Python-Library icon indicating copy to clipboard operation
My.Jdownloader-API-Python-Library copied to clipboard

Direct device access for myjdapi

Open hfr opened this issue 1 year ago • 2 comments

This modifications allows myjdapi to be used for a direct local connection to a JDownloader device without any interaction with the My.Downloader service.

hfr avatar Feb 27 '24 15:02 hfr

Thanks for your contribution. Will try to take a look at it at some point, probably this weekend.

mmarquezs avatar Feb 28 '24 16:02 mmarquezs

Thanks for your contribution. Will try to take a look at it at some point, probably this weekend.

I could test the direct device access with my configuration but I do not use My.Downloader at all. So it is necessary that some else is checking if my monkey-patches are conflicting with the normal operation via My.Downloader.

There is one other point which might need some research. My JD device was not happy with the parameter packaging of the original request_api() method. It especially did not like that the dict of the parameter was packaged as a string. Therefore I introduced a flag to allow for a transport as dict. I wonder why the local packaging might be different from the packaging via My.Downloader. Could it be that this might prevent the the usage of the direct communication even if it is available?

Here is the code I have modified:

            if params is not None:
                for param in params:
                    if (isinstance(param, dict) and not self.__dict_as_str) or isinstance(param, str) or isinstance(param, list):
                        params_request += [param]
                    elif (isinstance(param, dict) and self.__dict_as_str) or isinstance(param, bool):
                        params_request += [json.dumps(param)]
                    else:
                        params_request += [str(param)]

hfr avatar Feb 28 '24 19:02 hfr