Page MenuHomePhabricator
Paste P3009

(An Untitled Masterwork)
ActivePublic

Authored by MZMcBride on May 5 2016, 9:13 PM.
Tags
None
Referenced Files
F3970878:
May 5 2016, 9:13 PM
Subscribers
None
$ python --version
Python 2.7.2
>>> import json, urllib2
>>> api_url = 'http://en.wikipedia.org/w/api.php'
>>> api_params = 'action=query&list=recentchanges&rclimit=5000&rctype=edit&rcnamespace=0&rcdir=newer&format=json&rcstart=20160504022715'
>>> f = urllib2.Request(api_url, api_params)
>>> print ('requesting ' + api_url + '?' + api_params)
requesting http://en.wikipedia.org/w/api.php?action=query&list=recentchanges&rclimit=5000&rctype=edit&rcnamespace=0&rcdir=newer&format=json&rcstart=20160504022715
>>> source = urllib2.urlopen(f, None, 300).read()
>>> source = json.loads(source)
>>> type(source)
<type 'dict'>
>>> source[u'query'][u'recentchanges'][0][u'title']
u'Comedy Nights Live'