Exemplo n.º 1
0
# -*- coding:utf-8 -*-  
import confRead


#配置文件地址conf path
config_file_path = 'conf.ini'


#define default golobal parameters
ZHcode_list = [] #定义一个空的组合列表
mainURL = 'http://xuemainu.com/p/' #默认主URL
num_of_threads = 2 #默认设置两个工作线程

#从配置文件中读取全局参数
mainURL = confRead.read_config(config_file_path, 'URL', 'mainURL')
num_of_threads = int(confRead.read_config(config_file_path, 'NUM_OF_THREADS', 'num_of_threads')) 
ZHcode_list = confRead.read_config(config_file_path, 'ZHcode', 'zhcode').split(',')

def test():
   print "test beginning..."
   print mainURL,num_of_threads,ZHcode_list

if __name__ == '__main__':
    test()
Exemplo n.º 2
0
import ssh_connect
import confRead

# download files from remote host dir
if __name__ == "__main__":
    host_list = confRead.read_configBySection("config.ini", "HOST")
    remote_dir = confRead.read_config("config.ini", "DOWNLOADS_REMOTE_DIR", "REMOTE_DIR")
    for each_host in host_list:
        hostConf_list = each_host[1].strip().split(":")
        hostname = hostConf_list[0]
        port = hostConf_list[1]
        username = hostConf_list[2]
        passwd = hostConf_list[3]
        print remote_dir
        local_dir = "downloads/"
        # filesUpload(hostname,port,username,passwd,local_dir,remote_dir)
        ssh_connect.filesDownload(hostname, port, username, passwd, local_dir, remote_dir)
Exemplo n.º 3
0
import ssh_connect
import confRead

#download files from remote host dir
if __name__ == '__main__':
    host_list = confRead.read_configBySection('config.ini', 'HOST')
    remote_dir = confRead.read_config('config.ini', 'DOWNLOADS_REMOTE_DIR',
                                      'REMOTE_DIR')
    for each_host in host_list:
        hostConf_list = each_host[1].strip().split(':')
        hostname = hostConf_list[0]
        port = hostConf_list[1]
        username = hostConf_list[2]
        passwd = hostConf_list[3]
        print remote_dir
        local_dir = 'uploads/'
        #filesUpload(hostname,port,username,passwd,local_dir,remote_dir)
        ssh_connect.filesUpload(hostname, port, username, passwd, local_dir,
                                remote_dir)
Exemplo n.º 4
0
import ssh_connect
import confRead

#download files from remote host dir
if __name__=='__main__':
    host_list = confRead.read_configBySection('config.ini', 'HOST')
    remote_dir = confRead.read_config('config.ini', 'DOWNLOADS_REMOTE_DIR', 'REMOTE_DIR')
    for each_host in host_list:
        hostConf_list = each_host[1].strip().split(':')
        hostname = hostConf_list[0]
        port = hostConf_list[1]
        username = hostConf_list[2]
        passwd = hostConf_list[3]
        print remote_dir
        local_dir = 'uploads/'    
        #filesUpload(hostname,port,username,passwd,local_dir,remote_dir)
        ssh_connect.filesUpload(hostname,port,username,passwd,local_dir,remote_dir)