1 Commits

Author SHA1 Message Date
朱明明
7bdf2695e1 修改ftp返回 2020-04-16 17:41:31 +08:00

View File

@@ -1,7 +1,7 @@
import os
import subprocess
from time import sleep
import platform
class Order:
def CMD(self,data):
@@ -97,7 +97,7 @@ class Order:
return "Success"
else:
return "Fail"
# FTP 下载
# FTP 下载
def FTP_down(self, ftp_url,file_size,fiel_name):
windows_path = os.getcwd()
linux_path = os.getcwd().replace('\\', '/')
@@ -110,29 +110,19 @@ class Order:
fsize = os.path.getsize(linux_path + "/"+fiel_name) # 435814
print(fsize)
if fsize == file_size:
return "Success"
return "ftp_success"
else:
return "Fail"
return "ftp_fail"
# FTP 登录
def FTP_login(self, ftp_url,file_content):
SYS = self.Operating_System()
if SYS == "Windows":
data = 'curl -m 10 '+ftp_url+' | iconv -f utf-8 -t gbk'
d = self.CMD(data)
else:
data = 'curl -m 10 '+ftp_url
d = self.CMD(data)
data = 'curl -m 10 '+ftp_url+' | iconv -f utf-8 -t gbk'
d = self.CMD(data)
# print(d)
if file_content in d:
return "Success"
return "ftp_success"
else:
return "Fail"
# 判断当前操作系统
def Operating_System(self):
os_name = platform.system()
return os_name
return "ftp_fail"
if __name__ == '__main__':
datas = {"url":['https://www.baidu.com'],