Skip to content

Commit

Permalink
Added supported qbittorrent verison check
Browse files Browse the repository at this point in the history
  • Loading branch information
v1k45 committed Mar 11, 2016
1 parent 6853cd6 commit d49a6af
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion qbittorrent/client.py
Expand Up @@ -16,9 +16,19 @@ def __init__(self, url):

session = requests.Session()
check_prefs = session.get(url+'query/preferences')

if check_prefs.status_code == 200:
self._is_authenticated = True
self.session = session

elif check_prefs.status_code == 404:
self._is_authenticated = False
raise RuntimeError("""
This wrapper only supports qBittorrent applications
with version higher than 3.1.x.
Please use the latest qBittorrent release.
""")

else:
self._is_authenticated = False

Expand Down Expand Up @@ -370,7 +380,7 @@ def pause_multiple(self, infohash_list):
"""
data = self.process_infohash_list(infohash_list)
return self._post('command/pauseAll', data=data)

def set_label(self, infohash_list, label):
"""
Set the label on multiple torrents.
Expand Down

1 comment on commit d49a6af

@v1k45
Copy link
Owner Author

@v1k45 v1k45 commented on d49a6af Mar 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client raises RuntimeError when an unsupported version of qbittorrent is used. Will be used as warning to avoid issues like #4.

Please sign in to comment.