diff --git a/myjdapi/__init__.py b/myjdapi/__init__.py index 32ae807..ba78a03 100644 --- a/myjdapi/__init__.py +++ b/myjdapi/__init__.py @@ -34,4 +34,4 @@ MYJDUnknownException, ) -__version__ = "1.0.7" +__version__ = "1.1.0" diff --git a/myjdapi/myjdapi.py b/myjdapi/myjdapi.py index c043315..384647b 100644 --- a/myjdapi/myjdapi.py +++ b/myjdapi/myjdapi.py @@ -632,6 +632,12 @@ def force_download(self, link_ids=[], package_ids=[]): resp = self.device.action(self.url + "/forceDownload", params) return resp + def set_dl_location(self, directory, package_ids=[]): + params = [directory, package_ids] + resp = self.device.action(self.url + "/setDownloadDirectory", params) + return resp + + class Captcha: """ Class that represents the captcha interface of a Device @@ -745,8 +751,9 @@ def action(self, path, params=(), http_action="POST"): response = self.myjd.request_api(path, http_action, params, action_url) if response is None: - # My.JDownloader Api failed too. - return False + # My.JDownloader Api failed too we assume a problem with the connection or the api server + # and throw an connection exception. + raise (MYJDConnectionException("No connection established\n")) else: # My.JDownloader Api worked, lets refresh the direct connections and return # the response. @@ -781,8 +788,9 @@ def action(self, path, params=(), http_action="POST"): response = self.myjd.request_api(path, http_action, params, action_url) if response is None: - # My.JDownloader Api failed too. - return False + # My.JDownloader Api failed too we assume a problem with the connection or the api server + # and throw an connection exception. + raise (MYJDConnectionException("No connection established\n")) # My.JDownloader Api worked, lets refresh the direct connections and return # the response. self.__refresh_direct_connections() diff --git a/setup.py b/setup.py index dfe781f..518c545 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ long_description = f.read() setup( name='myjdapi', - version='1.0.7', + version='1.1.0', description='Library to use My.Jdownloader API in an easy way.', long_description=long_description, url='https://github.com/mmarquezs/My.Jdownloader-API-Python-Library/',