1 # 5. Find out how many revisions to the article on "Python
2 # (programming language)" were made by user "Peterl"? How about
7 # parameter version which makes a little more sense
8 parameters = {'action' : 'query',
10 'titles' : 'Python (programming language)',
12 'rvprop' : "ids|user",
16 user_list = ['Peterl', 'Hfastedge']
21 # run a "while True" loop
23 wp_call = requests.get('https://en.wikipedia.org/w/api.php', params=parameters)
24 response = wp_call.json()
26 for page_id in response["query"]["pages"].keys():
27 revisions = response["query"]["pages"][page_id]["revisions"]
30 if rev['user'] == "Peterl":
31 counter_peterl = counter_peterl + 1
32 if rev['user'] == "Hfastedge":
33 counter_hfastedge = counter_hfastedge + 1
35 if 'continue' in response:
36 parameters.update(response['continue'])
41 print("Peterl made %s edits" % counter_peterl)
42 print("Hfastedge made %s edits" % counter_hfastedge)