added example code that uses the urls
[wikipedia-api-cdsw] / wikipedia1-mwc1.py
diff --git a/wikipedia1-mwc1.py b/wikipedia1-mwc1.py
new file mode 100644 (file)
index 0000000..7671c84
--- /dev/null
@@ -0,0 +1,13 @@
+import time
+import simplejson as json
+import mwclient
+
+def format_time(t):
+    return(time.strftime('%Y-%m-%d %H:%M:%S', t))
+
+site = mwclient.Site('en.wikipedia.org')
+
+page = site.Pages["Data science"]
+
+for revision in page.revisions():
+    print revision["user"] + "\t" + format_time(revision['timestamp'])

Benjamin Mako Hill || Want to submit a patch?