diff --git a/04-CustomLibrary/Custometest/cmd_cer.py b/04-CustomLibrary/Custometest/cmd_cer.py index 6e6e636..5a4ca19 100644 --- a/04-CustomLibrary/Custometest/cmd_cer.py +++ b/04-CustomLibrary/Custometest/cmd_cer.py @@ -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('\\', '/') @@ -116,14 +116,24 @@ class Order: # FTP 登录 def FTP_login(self, ftp_url,file_content): - data = 'curl -m 10 '+ftp_url+' | iconv -f utf-8 -t gbk' - d = self.CMD(data) - # print(d) + 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) + if file_content in d: return "Success" else: return "Fail" + # 判断当前操作系统 + def Operating_System(self): + os_name = platform.system() + return os_name + if __name__ == '__main__': datas = {"url":['https://www.baidu.com'], "Certificate":"Tango Secure Gateway CA",