-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
33 lines (25 loc) · 1.09 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import check_references, reports, alerts
import pywikibot
def update_wiki_page(page_title, new_content):
site = pywikibot.Site()
page = pywikibot.Page(site, page_title)
# Check if the page exists and if the new content is different
if page.exists() and page.text != new_content:
page.text = new_content
page.save(f"Updating {page_title} with new content")
print(f"{page_title} has been updated.")
else:
print(f"{page_title} does not exist or has no changes.")
def main():
# Refreshing reference database
check_references.go()
# Generating contents of [[Wikipedia:Vaccine safety/Reports]]
Reports_content = reports.generate_wikipage()
# Update [[Wikipedia:Vaccine Safety/Reports]] page
update_wiki_page("Wikipedia:Vaccine safety/Reports", Reports_content)
# Generating contents of [[Wikipedia:Vaccine safety/Alerts]]
Alerts_content = alerts.get_alerts_page()
# Update [[Wikipedia:Vaccine Safety/Alerts]] page
update_wiki_page("Wikipedia:Vaccine safety/Alerts", Alerts_content)
if __name__ == '__main__':
main()