1 # 2. Print out the revision ids and edit summaries (i.e., comment) of each revision for the article on Python.
5 # parameter version which makes a little more sense
6 parameters = {'action' : 'query',
8 'titles' : 'Python (programming language)',
10 # changed this line to add ids|comment
11 'rvprop' : "ids|comment",
15 # run a "while True" loop
17 wp_call = requests.get('https://en.wikipedia.org/w/api.php', params=parameters)
18 response = wp_call.json()
20 for page_id in response["query"]["pages"].keys():
21 revisions = response["query"]["pages"][page_id]["revisions"]
24 # changed this line to add revid and comment
25 print(str(rev["revid"]) + "\t" + rev["comment"])
27 if 'continue' in response:
28 parameters.update(response['continue'])