def getUserPassword(host='www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'):
    """"Getting the username/password for host from .netrc filie """
    if os.access(os.path.join(os.environ.get('HOME','/'),".netrc"),os.R_OK):
        auth=netrc.netrc().authenticators(host)
    else:
        auth=False
    if not auth:
        sys.stdout.write("CADC Username: ")
        username=sys.stdin.readline().strip('\n')
        password=getpass.getpass().strip('\n')
    else:
        username=auth[0]
        password=auth[2]
    return (username,password)
def getUserPassword ( host = 'www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca' ) : if os . access ( os . path . join ( os . environ . get ( 'HOME' , '/' ) , ".netrc" ) , os . R_OK ) : auth = netrc . netrc ( ) . authenticators ( host ) else : auth = False if not auth : sys . stdout . write ( "CADC Username: " ) username = sys . stdin . readline ( ) . strip ( '\n' ) password = getpass . getpass ( ) . strip ( '\n' ) else : username = auth [ 0 ] password = auth [ 2 ] return ( username , password )
Getting the username/password for host from .netrc filie