From 84fd39418d66c820da4eeb5d7f3e1dd8baaceea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=98=8E=E6=98=8E?= Date: Tue, 14 Apr 2020 17:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=85=B3=E9=94=AE=E5=AD=97=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9ftp=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-CustomLibrary/Custometest/cmd_cer.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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",