Skip to content

Commit ea84370

Browse files
committed
feat: add FTP_TLS
1 parent 087f061 commit ea84370

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ftp: {}
2323
#port: 21 # FTP port
2424
#user: "" # FTP user
2525
#password: "" # FTP password
26+
tls: True
2627
# Remote path on the FTP server
2728
#remote_path: "" # Example: "/torrents/qbittorrent/"
2829

qbit_watcher/ftp.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import logging
33

4-
from ftplib import FTP
4+
from ftplib import FTP_TLS, FTP
55
from qbit_watcher.ftp_util import parse_file
66

77
LOGGER = logging.getLogger(__name__)
@@ -17,9 +17,17 @@ def get_client(self):
1717
"""
1818
Returns a ftp connection
1919
"""
20-
ftp = FTP()
20+
if self.conf['tls']:
21+
ftp = FTP_TLS()
22+
else:
23+
ftp = FTP()
24+
2125
ftp.connect(host=self.conf['domain'], port=self.conf['port'])
2226
ftp.login(self.conf['user'], self.conf['password'])
27+
28+
if self.conf['tls']:
29+
ftp.prot_p()
30+
2331
ftp.cwd( self.conf['remote_path'])
2432
LOGGER.info("Successfully connected to '%s' FTP server" % (self.conf['domain']))
2533
return ftp

requirements.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pyyaml==5.1.2
2-
pysftp==0.2.9
3-
pyinstaller==4.0
4-
qbittorrent-api==2020.10.11
5-
watchdog==0.10.3
6-
win10toast==0.9
7-
infi.systray==0.1.12
1+
pyyaml==5.4.1
2+
pysftp==0.2.9
3+
pyinstaller==4.0
4+
qbittorrent-api==2020.10.11
5+
watchdog==0.10.3
6+
win10toast==0.9
7+
infi.systray==0.1.12

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
install_requires=[
1414
"pysftp==0.2.9",
15-
"pyyaml==5.1.2",
15+
"pyyaml==5.4.1",
1616
"qbittorrent-api==2020.10.11",
1717
"watchdog==0.10.3",
1818
"win10toast==0.9",

0 commit comments

Comments
 (0)