]> projects.mako.cc - wikipedia-api-cdsw/blob - wikipedia-raw1.py
05222a2ffd55b3ae59ae2c17f344dc3f5e869207
[wikipedia-api-cdsw] / wikipedia-raw1.py
1 import requests
2
3 wp_call = requests.get('https://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Main_Page&rvlimit=100&rvprop=timestamp|user&format=json')
4
5 response = wp_call.json()
6
7 for page_id in response["query"]["pages"].keys():
8     page_title = response["query"]["pages"][page_id]["title"]
9     revisions = response["query"]["pages"][page_id]["revisions"]
10
11     for rev in revisions:
12         print(page_title + "\t" + rev["user"] + "\t" + rev["timestamp"])
13

Benjamin Mako Hill || Want to submit a patch?