wangzhibo
2022-03-23 f974d1d3e4c89cf1d89f86e50170ebfb93a6445a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
 
 
#测试下载
__author__ = '上海色宁'
 
 
import os
import requests
 
 
 
def download_config_file():
    remote_config_file = "http://192.168.43.204:80/k2/huaneng_2_power_1_config.py"
    r = requests.get(remote_config_file, stream=True)
    with open("setting1.py",'wb') as f:
        # 分块写入文件
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)
    f.close()
    print("request and download config file finished . programe will restarted.")
      
 
#程序入口
if __name__ == '__main__':
    download_config_file()