]> projects.mako.cc - wikipedia-api-cdsw/blobdiff - wikipedia-raw1.py
two quick updates to the raw files
[wikipedia-api-cdsw] / wikipedia-raw1.py
index fef3a582647dacd2c5f2209e698f0f5ae3edaabd..05222a2ffd55b3ae59ae2c17f344dc3f5e869207 100644 (file)
@@ -1,14 +1,13 @@
-import json
 import requests
 
 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')
 
-response = json.loads(wp_call.content)
+response = wp_call.json()
 
 for page_id in response["query"]["pages"].keys():
     page_title = response["query"]["pages"][page_id]["title"]
     revisions = response["query"]["pages"][page_id]["revisions"]
 
     for rev in revisions:
-        print page_title + "\t" + rev["user"] + "\t" + rev["timestamp"]
+        print(page_title + "\t" + rev["user"] + "\t" + rev["timestamp"])
 

Benjamin Mako Hill || Want to submit a patch?