예제 #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)