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

from fiji import MediaWikiClient

client = MediaWikiClient(url)
if user != None and password != None and not client.isLoggedIn():
    client.logIn(user, password)
response = client.sendRequest(
    ['title', 'Special:RecentChanges', 'hidebots', '0'], None)
if client.isLoggedIn():
    client.logOut()
'''
f = open('a1', 'r')
response = ''.join(f.readlines())
f.close()
'''

result = ''
for line in response.split('\n'):
    i = line.find('<h4>')
    if i >= 0:
        line = line[i + 4:]
예제 #2
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