@@ -264,8 +264,8 @@ def get_default_threads():
264264 # os.cpu_count() might not be available in some environments
265265 return 1
266266
267- __upload_proto_support__ = "^(ftp|ftps|sftp):\\ /\\ /"
268- __download_proto_support__ = "^(http|https|ftp|ftps|sftp):\\ /\\ /"
267+ __upload_proto_support__ = "^(ftp|ftps|sftp|scp ):\\ /\\ /"
268+ __download_proto_support__ = "^(http|https|ftp|ftps|sftp|scp ):\\ /\\ /"
269269__use_pysftp__ = False
270270if (not havepysftp ):
271271 __use_pysftp__ = False
@@ -9386,7 +9386,7 @@ def download_file_from_ftp_file(url):
93869386 ftp = FTP_TLS ()
93879387 else :
93889388 return False
9389- if (urlparts .scheme == "sftp" ):
9389+ if (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
93909390 if (__use_pysftp__ ):
93919391 return download_file_from_pysftp_file (url )
93929392 else :
@@ -9484,7 +9484,7 @@ def upload_file_to_ftp_file(ftpfile, url):
94849484 ftp = FTP_TLS ()
94859485 else :
94869486 return False
9487- if (urlparts .scheme == "sftp" ):
9487+ if (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
94889488 if (__use_pysftp__ ):
94899489 return upload_file_to_pysftp_file (url )
94909490 else :
@@ -9599,7 +9599,7 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__):
95999599 urlparts .params , urlparts .query , urlparts .fragment ))
96009600
96019601 # Handle SFTP/FTP
9602- if urlparts .scheme == "sftp" :
9602+ if urlparts .scheme == "sftp" or urlparts . scheme == "scp" :
96039603 if __use_pysftp__ :
96049604 return download_file_from_pysftp_file (url )
96059605 else :
@@ -9701,7 +9701,7 @@ def download_file_from_sftp_file(url):
97019701 return download_file_from_ftp_file (url )
97029702 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
97039703 return download_file_from_http_file (url )
9704- if (urlparts .scheme != "sftp" ):
9704+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
97059705 return False
97069706 ssh = paramiko .SSHClient ()
97079707 ssh .load_system_host_keys ()
@@ -9762,7 +9762,7 @@ def upload_file_to_sftp_file(sftpfile, url):
97629762 return upload_file_to_ftp_file (sftpfile , url )
97639763 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
97649764 return False
9765- if (urlparts .scheme != "sftp" ):
9765+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
97669766 return False
97679767 ssh = paramiko .SSHClient ()
97689768 ssh .load_system_host_keys ()
@@ -9823,7 +9823,7 @@ def download_file_from_pysftp_file(url):
98239823 return download_file_from_ftp_file (url )
98249824 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
98259825 return download_file_from_http_file (url )
9826- if (urlparts .scheme != "sftp" ):
9826+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
98279827 return False
98289828 try :
98299829 sftp = pysftp .Connection (urlparts .hostname , port = sftp_port ,
@@ -9880,7 +9880,7 @@ def upload_file_to_pysftp_file(sftpfile, url):
98809880 return upload_file_to_ftp_file (sftpfile , url )
98819881 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
98829882 return False
9883- if (urlparts .scheme != "sftp" ):
9883+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
98849884 return False
98859885 try :
98869886 sftp = pysftp .Connection (urlparts .hostname , port = sftp_port ,
@@ -9920,7 +9920,7 @@ def download_file_from_internet_file(url, headers=geturls_headers_pyfile_python_
99209920 return download_file_from_http_file (url , headers , usehttp )
99219921 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99229922 return download_file_from_ftp_file (url )
9923- elif (urlparts .scheme == "sftp" ):
9923+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99249924 if (__use_pysftp__ and havepysftp ):
99259925 return download_file_from_pysftp_file (url )
99269926 else :
@@ -9945,7 +9945,7 @@ def download_file_from_internet_string(url, headers=geturls_headers_pyfile_pytho
99459945 return download_file_from_http_string (url , headers )
99469946 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99479947 return download_file_from_ftp_string (url )
9948- elif (urlparts .scheme == "sftp" ):
9948+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99499949 if (__use_pysftp__ and havepysftp ):
99509950 return download_file_from_pysftp_string (url )
99519951 else :
@@ -9972,7 +9972,7 @@ def upload_file_to_internet_file(ifp, url):
99729972 return False
99739973 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99749974 return upload_file_to_ftp_file (ifp , url )
9975- elif (urlparts .scheme == "sftp" ):
9975+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99769976 if (__use_pysftp__ and havepysftp ):
99779977 return upload_file_to_pysftp_file (ifp , url )
99789978 else :
@@ -9997,7 +9997,7 @@ def upload_file_to_internet_string(ifp, url):
99979997 return False
99989998 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99999999 return upload_file_to_ftp_string (ifp , url )
10000- elif (urlparts .scheme == "sftp" ):
10000+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
1000110001 if (__use_pysftp__ and havepysftp ):
1000210002 return upload_file_to_pysftp_string (ifp , url )
1000310003 else :
0 commit comments