#!/usr/bin/python
# -*- coding: utf-8 -*-
# Abbas (Ar:User:Elph), 2012
# update: 2015
import catlib ,pagegenerators
import wikipedia,urllib,gzip,codecs,re
import MySQLdb as mysqldb
import config
adress=u"مستخدم:جار الله/تعديلات"
message=u"تحديث"
rowi=' '
#---------------------------------------------- sql part--------------
site = wikipedia.getSite("ar")
query = '''SELECT user_editcount FROM user WHERE user_name LIKE "جار_الله";'''
wikipedia.output(u'Executing query:\n%s' % query)
conn = mysqldb.connect("arwiki.labsdb", db = site.dbName(),
user = config.db_username,
passwd = config.db_password)
cursor = conn.cursor()
query = query.encode(site.encoding())
cursor.execute(query)
results = cursor.fetchall()
#---------------------------------------------- end of sql part---------
for row in results:
rowi=unicode(str(row[0]),'UTF-8')
text=rowi.strip()
page = wikipedia.Page(site,adress)
page.put(text,message)