]> code.communitydata.science - rises_declines_wikia_code.git/blob - mediawiki_dump_tools/Mediawiki-Utilities/examples/database.users.py
add copy of the GPL
[rises_declines_wikia_code.git] / mediawiki_dump_tools / Mediawiki-Utilities / examples / database.users.py
1 """
2
3 """
4 import os
5 import sys
6
7 try:
8     
9     sys.path.insert(0, os.path.abspath(os.getcwd()))
10     from mw import database
11     
12 except:
13     raise
14
15
16
17 db = database.DB.from_params(
18     host="analytics-store.eqiad.wmnet",
19     read_default_file="~/.my.cnf",
20     user="research",
21     db="enwiki"
22 )
23
24 users = db.users.query(
25     registered_after="20140101000000",
26     direction="newer",
27     limit=10
28 )
29
30 for user in users:
31     print("{user_id}:{user_name} -- {user_editcount} edits".format(**user))

Community Data Science Collective || Want to submit a patch?