See also tybot on GitHub
import getpass
import time
import tybot

password = getpass.getpass("Password: ")

mw = tybot.tybot("TyABot", password, "http://en.wikipedia.org/w")
blcontinue=''
pages = []
while 1:
	response = mw.get_backlinks(title="User:Ale_jrb/Scripts/igloo", namespace=2, redirects="nonredirects", blcontinue=blcontinue)
	for page in response["query"]["backlinks"]:
		print page
		skinStart = page["title"].find("/")
		pages.append(page["title"][0:skinStart].replace("User:","User talk:").encode('utf-8'))
		
	try:
		blcontinue=response["query-continue"]["backlinks"]["blcontinue"]
	except:
		break

for page in pages:
	content = mw.get_page_content(page).encode('utf-8')
	if content.lower().find("{{bots|optout=all}}") == -1:
		pass
	else:
		content += "\n\n== Igloo is back! ==\nWe are proud to announce that [[WP:Igloo|]] is once again functioning. ''This message was sent by [[User:TyBot|]] for [[User:Kangaroopower|]], one of Igloo's current maintainers at ~~~~~.''"
		mw.edit(page,content, "Notifying user that igloo is back")
		time.sleep(10)