@@ -266,8 +266,8 @@ def get_default_threads():
266266
267267
268268__use_pysftp__ = False
269- __upload_proto_support__ = "^(ftp|ftps|sftp):\\ /\\ /"
270- __download_proto_support__ = "^(http|https|ftp|ftps|sftp):\\ /\\ /"
269+ __upload_proto_support__ = "^(ftp|ftps|sftp|scp ):\\ /\\ /"
270+ __download_proto_support__ = "^(http|https|ftp|ftps|sftp|scp ):\\ /\\ /"
271271if (not havepysftp ):
272272 __use_pysftp__ = False
273273__use_http_lib__ = "httpx"
@@ -4157,7 +4157,8 @@ def GzipCompressData(data, compresslevel=9):
41574157 out = MkTempFile ()
41584158 with gzip .GzipFile (fileobj = out , mode = "wb" , compresslevel = compresslevel ) as f :
41594159 f .write (data )
4160- compressed_data = out .getvalue ()
4160+ out .seek (0 , 0 )
4161+ compressed_data = out .read ()
41614162 return compressed_data
41624163
41634164
@@ -9398,7 +9399,7 @@ def download_file_from_ftp_file(url):
93989399 ftp = FTP_TLS ()
93999400 else :
94009401 return False
9401- if (urlparts .scheme == "sftp" ):
9402+ if (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
94029403 if (__use_pysftp__ ):
94039404 return download_file_from_pysftp_file (url )
94049405 else :
@@ -9496,7 +9497,7 @@ def upload_file_to_ftp_file(ftpfile, url):
94969497 ftp = FTP_TLS ()
94979498 else :
94989499 return False
9499- if (urlparts .scheme == "sftp" ):
9500+ if (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
95009501 if (__use_pysftp__ ):
95019502 return upload_file_to_pysftp_file (url )
95029503 else :
@@ -9611,7 +9612,7 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__):
96119612 urlparts .params , urlparts .query , urlparts .fragment ))
96129613
96139614 # Handle SFTP/FTP
9614- if urlparts .scheme == "sftp" :
9615+ if urlparts .scheme == "sftp" or urlparts . scheme == "scp" :
96159616 if __use_pysftp__ :
96169617 return download_file_from_pysftp_file (url )
96179618 else :
@@ -9713,7 +9714,7 @@ def download_file_from_sftp_file(url):
97139714 return download_file_from_ftp_file (url )
97149715 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
97159716 return download_file_from_http_file (url )
9716- if (urlparts .scheme != "sftp" ):
9717+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
97179718 return False
97189719 ssh = paramiko .SSHClient ()
97199720 ssh .load_system_host_keys ()
@@ -9774,7 +9775,7 @@ def upload_file_to_sftp_file(sftpfile, url):
97749775 return upload_file_to_ftp_file (sftpfile , url )
97759776 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
97769777 return False
9777- if (urlparts .scheme != "sftp" ):
9778+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
97789779 return False
97799780 ssh = paramiko .SSHClient ()
97809781 ssh .load_system_host_keys ()
@@ -9835,7 +9836,7 @@ def download_file_from_pysftp_file(url):
98359836 return download_file_from_ftp_file (url )
98369837 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
98379838 return download_file_from_http_file (url )
9838- if (urlparts .scheme != "sftp" ):
9839+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
98399840 return False
98409841 try :
98419842 sftp = pysftp .Connection (urlparts .hostname , port = sftp_port ,
@@ -9892,7 +9893,7 @@ def upload_file_to_pysftp_file(sftpfile, url):
98929893 return upload_file_to_ftp_file (sftpfile , url )
98939894 elif (urlparts .scheme == "http" or urlparts .scheme == "https" ):
98949895 return False
9895- if (urlparts .scheme != "sftp" ):
9896+ if (urlparts .scheme != "sftp" and urlparts . scheme != "scp" ):
98969897 return False
98979898 try :
98989899 sftp = pysftp .Connection (urlparts .hostname , port = sftp_port ,
@@ -9932,7 +9933,7 @@ def download_file_from_internet_file(url, headers=geturls_headers_pyfile_python_
99329933 return download_file_from_http_file (url , headers , usehttp )
99339934 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99349935 return download_file_from_ftp_file (url )
9935- elif (urlparts .scheme == "sftp" ):
9936+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99369937 if (__use_pysftp__ and havepysftp ):
99379938 return download_file_from_pysftp_file (url )
99389939 else :
@@ -9957,7 +9958,7 @@ def download_file_from_internet_string(url, headers=geturls_headers_pyfile_pytho
99579958 return download_file_from_http_string (url , headers )
99589959 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99599960 return download_file_from_ftp_string (url )
9960- elif (urlparts .scheme == "sftp" ):
9961+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99619962 if (__use_pysftp__ and havepysftp ):
99629963 return download_file_from_pysftp_string (url )
99639964 else :
@@ -9984,7 +9985,7 @@ def upload_file_to_internet_file(ifp, url):
99849985 return False
99859986 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
99869987 return upload_file_to_ftp_file (ifp , url )
9987- elif (urlparts .scheme == "sftp" ):
9988+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
99889989 if (__use_pysftp__ and havepysftp ):
99899990 return upload_file_to_pysftp_file (ifp , url )
99909991 else :
@@ -10009,7 +10010,7 @@ def upload_file_to_internet_string(ifp, url):
1000910010 return False
1001010011 elif (urlparts .scheme == "ftp" or urlparts .scheme == "ftps" ):
1001110012 return upload_file_to_ftp_string (ifp , url )
10012- elif (urlparts .scheme == "sftp" ):
10013+ elif (urlparts .scheme == "sftp" or urlparts . scheme == "scp" ):
1001310014 if (__use_pysftp__ and havepysftp ):
1001410015 return upload_file_to_pysftp_string (ifp , url )
1001510016 else :
0 commit comments