[feature] Add SSL options to qBittorrent plugin#2074
[feature] Add SSL options to qBittorrent plugin#2074cvium merged 4 commits intoFlexget:developfrom wimex:qbittorrent-ssl
Conversation
| self.session = Session() | ||
| self.url = 'http://{}:{}'.format(config['host'], config['port']) | ||
| self.url = '{}://{}:{}'.format('http' if config['use_ssl']==False else 'https', config['host'], config['port']) | ||
| if config.get('username') and config.get('password'): |
There was a problem hiding this comment.
- You probably meant the opposite,
httpsifuse_sslis True. - Explicitly checking if a statement is True should be made with the
iscomparator:if var is True: - It's more python to check for truthiness directly:
'https' if config['use_ssl'] else 'http'
| self._request('post', self.url + '/command/upload', msg_on_fail='Failed to add file to qBittorrent', | ||
| files=multipart_data) | ||
| log.debug('Added torrent file %s to qBittorrent', file_path) | ||
| log.debug('Added torrent file %s to qBittorrent', file_path, verify=config['verify_cert']) |
There was a problem hiding this comment.
If you wanna add verify status in here, fix the message as well
There was a problem hiding this comment.
Thanks for the insights!
This one was a mistake, I wanted to add the parameter to the previous line.
Everything else has been fixed.
| entry.fail("Downloaded temp file '%s' doesn't exist!?" % entry['file']) | ||
| continue | ||
| self.add_torrent_file(entry['file'], form_data) | ||
| self.add_torrent_file(entry['file'], form_data, config) |
There was a problem hiding this comment.
Don't pass the whole config if you just need it for the verify cert, pass just that
| data = {'username': config['username'], | ||
| 'password': config['password']} | ||
| self._request('post', self.url + '/login', data=data, msg_on_fail='Authentication failed.') | ||
| self._request('post', self.url + '/login', data=data, msg_on_fail='Authentication failed.', verify=config['verify_cert']) |
There was a problem hiding this comment.
This line is 14 chars too long.
| multipart_data['torrents'] = f | ||
| self._request('post', self.url + '/command/upload', msg_on_fail='Failed to add file to qBittorrent', | ||
| files=multipart_data) | ||
| files=multipart_data, verify=verify_cert) |
There was a problem hiding this comment.
Pep8 alignment issues here. The start of the second line inside parentheses should line up with the opening parenthesis ie.
self._request('post', self.url + '/command/upload', msg_on_fail='Failed to add file to qBittorrent',
files=multipart_data, verify=verify_cert)
Fix that here and on line 94 and it should be good to go.
There was a problem hiding this comment.
Also fixed it in line 74
|
Thanks. Can you update the wiki as well? |
|
I have updated the wiki |
Motivation for changes:
The qBittorrent plugin is currently unable to add torrents over a secure web interface
Detailed changes:
This commit adds two new options to the qBittorrent plugin configuration:
Config usage if relevant (new plugin or updated schema):
For example:
qbittorrent:
host: 192.168.1.2
port: 8080
use_ssl: yes
verify_cert: no