File tree Expand file tree Collapse file tree 4 files changed +22
-199
lines changed Expand file tree Collapse file tree 4 files changed +22
-199
lines changed Original file line number Diff line number Diff line change @@ -162,9 +162,6 @@ Built-in Implementations
162
162
.. autoclass :: fsspec.implementations.ftp.FTPFileSystem
163
163
:members: __init__
164
164
165
- .. autoclass :: fsspec.implementations.ftp.FTPTLSFileSystem
166
- :members: __init__
167
-
168
165
.. autoclass :: fsspec.implementations.git.GitFileSystem
169
166
:members: __init__
170
167
Original file line number Diff line number Diff line change @@ -27,8 +27,7 @@ def __init__(
27
27
tempdir = None ,
28
28
timeout = 30 ,
29
29
encoding = "utf-8" ,
30
- ssl = False ,
31
- prot_p = False ,
30
+ tls = False ,
32
31
** kwargs ,
33
32
):
34
33
"""
@@ -58,26 +57,28 @@ def __init__(
58
57
Timeout of the ftp connection in seconds
59
58
encoding: str
60
59
Encoding to use for directories and filenames in FTP connection
60
+ tls: bool
61
+ Use FTP-TLS, by default False
61
62
"""
62
63
super ().__init__ (** kwargs )
63
64
self .host = host
64
65
self .port = port
65
66
self .tempdir = tempdir or "/tmp"
66
- self .cred = username , password , acct
67
+ self .cred = username or "" , password or "" , acct or ""
68
+ print (self .cred )
67
69
self .timeout = timeout
68
70
self .encoding = encoding
69
71
if block_size is not None :
70
72
self .blocksize = block_size
71
73
else :
72
74
self .blocksize = 2 ** 16
73
- self .ssl = ssl
74
- self .prot_p = prot_p
75
+ self .tls = tls
75
76
self ._connect ()
76
- if self .prot_p :
77
+ if self .tls :
77
78
self .ftp .prot_p ()
78
79
79
80
def _connect (self ):
80
- if self .ssl :
81
+ if self .tls :
81
82
ftp_cls = FTP_TLS
82
83
else :
83
84
ftp_cls = FTP
Original file line number Diff line number Diff line change 2
2
import subprocess
3
3
import sys
4
4
import time
5
+ from ftplib import FTP , FTP_TLS
5
6
6
7
import pytest
7
8
@@ -29,6 +30,19 @@ def ftp():
29
30
P .wait ()
30
31
31
32
33
+ @pytest .mark .parametrize (
34
+ "tls,exp_cls" ,
35
+ (
36
+ (False , FTP ),
37
+ (True , FTP_TLS ),
38
+ ),
39
+ )
40
+ def test_tls (ftp , tls , exp_cls ):
41
+ host , port = ftp
42
+ fs = FTPFileSystem (host , port , tls = tls )
43
+ assert isinstance (fs .ftp , exp_cls )
44
+
45
+
32
46
def test_basic (ftp ):
33
47
host , port = ftp
34
48
fs = FTPFileSystem (host , port )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments