示例#1
0
def _download_files(file_urls, username, password, download_directory='/tmp'):
    ''''''
    try:
        logon2(username, password)
    except urllib2.HTTPError:
        raise ValueError('esgf._download_files: Invalid login credentials')

    for url in file_urls:
        download(url, toDirectory=download_directory)
示例#2
0
文件: esgf.py 项目: AtomLaw/climate
def _download_files(file_urls, username, password, download_directory='/tmp'):
    ''''''
    try:
        logon2(username, password)
    except urllib2.HTTPError:
        raise ValueError('esgf._download_files: Invalid login credentials')

    for url in file_urls:
        download(url, toDirectory=download_directory)
示例#3
0
文件: main.py 项目: AtomLaw/climate
def main():
    '''Example driver program'''
    
    # step 1: obtain short-term certificate
    print 'Retrieving ESGF certificate...'
    # logon using client-side MyProxy libraries
    #if logon(USER_OPENID, USER_PASSWORD):
    #    print "...done."
    # logon through server-side MyProxy service
    if logon2(USER_OPENID, USER_PASSWORD):
        print "...done"
    
    # step 2: execute faceted search for files
    urls = main_obs4mips()
    #urls = main_cmip5()
    
    # step 3: download file(s)
    for i, url in enumerate(urls):
        if i>=1:
            break
        download(url, toDirectory=DATA_DIRECTORY)
示例#4
0
def main():
    '''Example driver program'''

    # step 1: obtain short-term certificate
    print 'Retrieving ESGF certificate...'
    # logon using client-side MyProxy libraries
    #if logon(USER_OPENID, USER_PASSWORD):
    #    print "...done."
    # logon through server-side MyProxy service
    if logon2(USER_OPENID, USER_PASSWORD):
        print "...done"

    # step 2: execute faceted search for files
    urls = main_obs4mips()
    #urls = main_cmip5()

    # step 3: download file(s)
    for i, url in enumerate(urls):
        if i >= 1:
            break
        download(url, toDirectory=DATA_DIRECTORY)