12345678910111213141516171819202122232425262728293031 |
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- # Author: Omar Vega Ramos
- # E-mail: ovruni@riseup.net
- # License: GNU GPL - GNU General Public License v3.0 or later
- # http://www.gnu.org/licenses/gpl.html
- import sys, os.path
- import pywikibot
- if os.path.isfile("users.txt") == False :
- sys.exit("The file 'users.txt' does not exist")
- if os.path.isfile("message.txt") == False :
- sys.exit("The file 'message.txt' does not exist")
- users_file = open("users.txt", "r")
- message_file = open("message.txt", "r")
- message = message_file.read()
- site = pywikibot.Site()
- summary = input("Please add the edit summary: ")
- for user in users_file:
- username = user.strip()
- user_talk = "User talk:" + username
- user_page = pywikibot.Page(site, user_talk)
- current_text = user_page.text
- user_page.put(current_text + "\n\n" + message, summary)
- users_file.close()
- message_file.close()
|