import pywikibot as pw
import requests
import json

def isActive(user, project, start, end):
    start = start + 'T00:00:00Z'
    end = end + 'T00:00:00Z'
    url = 'https://hy.' + project + '.org/' + '/w/api.php?action=query&format=json&list=usercontribs&uclimit=1&ucstart=' + start + '&ucend=' + end + '&ucuser=' + user
    r = requests.get(url)
    j = json.loads(r.content)
    if len(j['query']['usercontribs']) == 0:
        return False
    return True

with open('./users.txt', 'r', encoding='utf-8') as f:
    lines = f.readlines()
    for line in lines:
        user = line.replace('\n', '')
        wikipedia = isActive(user, 'wikipedia', '2019-11-01', '2019-10-01') 
        wikisource = isActive(user, 'wikisource', '2019-11-01', '2019-10-01') 
        wiktionary = isActive(user, 'wiktionary', '2019-11-01', '2019-10-01') 
        if wikipedia or wikisource or wiktionary:
            print(1)
        else:
            print(0)
print('done')
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
1
1
1
0
1
0
1
1
1
0
0
0
1
0
0
0
1
0
0
0
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
1
0
1
done