# welcome.py # import asyncio from pywikibot import Site, Page, TitleblacklistError site = Site() logNewUsers = site.logevents('newusers', total = 5000) count = 0 for entry in logNewUsers: user = entry['user'] page = Page(site, 'Thảo luận Thành viên:' + user) if not page.exists(): page.text = '{{thế:welcome12}}\n[[Thành viên:P.T.Đ|P.T.Đ]] ([[Thảo luận Thành viên:P.T.Đ|thảo luận]]) ~~~~~' try: page.save(summary = 'Hoan nghênh thành viên mới!', minor = True, botflag = True, asynchronous = True) except TitleblacklistError: print('Page [[' + page.title() + ']] is title-blacklisted.') count += 1 # await asyncio.sleep(1) print('Number of created welcome pages: ' + str(count)) # API error mwoauth-invalid-authorization # API error titleblacklist-forbidden