diff options
| author | 朱明明 <[email protected]> | 2020-04-14 17:19:18 +0800 |
|---|---|---|
| committer | 朱明明 <[email protected]> | 2020-04-14 17:19:18 +0800 |
| commit | 84fd39418d66c820da4eeb5d7f3e1dd8baaceea0 (patch) | |
| tree | baf3b7169f8666602e7586b89acc0067a86a86cf | |
| parent | acc676857bd85512f344a8d06aa1ae8846e7c0db (diff) | |
添加获取操作系统关键字和修改ftp登录patch-1
| -rw-r--r-- | 04-CustomLibrary/Custometest/cmd_cer.py | 20 |
1 files 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", |
