# -*- coding: utf-8 -*-
import pywikibot
import time

def find_replace_page(page):
	wp_page = pywikibot.Page(pywikibot.Site("en", "wikipedia"), page)
	wp_page.text = wp_page.text.replace("http://findingaid.lib.byu.edu", "https://findingaid.lib.byu.edu")
	wp_page.save(summary="Replacing http [[Brigham Young University|BYU]] findingaid links with https (TEST)")
	return None

links = [l.rstrip("\n") for l in open("links.txt", "r")])

for l in links:
	find_replace_page(l)
	time.sleep(10)