import pywikibot
import re
import os
import pymysql
site = pywikibot.Site('zh', 'wikipedia')
site.login()
host = os.environ['MYSQL_HOST']
user = os.environ['MYSQL_USERNAME']
password = os.environ['MYSQL_PASSWORD']
conn = pymysql.connect(
    host=host,
    user=user,
    password=password,
    charset="utf8"
)
with conn.cursor() as cur:
    cur.execute('use zhwiki_p')
    cur.execute("""
        SELECT log_namespace, log_title
        FROM logging
        WHERE log_type = "delete"
        AND log_action = "delete"
        ORDER BY log_timestamp DESC
        LIMIT 10
    """)
    res = cur.fetchall()
for row in res:
    print(row[0], row[1].decode())
0 2014年亞洲單車錦標賽
0 佛教創世神
0 打扁
0 张军_(航空交通工程专家)
0 汤梦佳
0 阿尔衮琴人
0 郭通
0 郭华强
1 統一教會
1 翁瑋盈