Ejemplo n.º 1
0
                f = open(home + '/.netrc')
                for line in f.readlines():
                    line = line.strip()
                    if line == 'machine ' + host:
                        found = True
                    elif found == False:
                        continue
                    elif line.startswith('login '):
                        user = line[6:]
                    elif line.startswith('password '):
                        password = line[9:]
                    elif line.startswith('machine '):
                        break
                f.close()
    
            if not client.isLoggedIn():
                if user != None and password != None:
                    client.logIn(user, password)
                    response = client.uploadPage(PAGE, result, 'Updated by plugin-list-parser')
                    if client.isLoggedIn():
                        client.logOut()
                    if not response:
                        print 'There was a problem with uploading', PAGE
                        if IJ.getInstance() == None:
                            sys.exit(1)
                else:
                    print 'No .netrc entry for', URL
                    if IJ.getInstance() == None:
                        sys.exit(1)
else:
    print result