Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P3009
(An Untitled Masterwork)
Active
Public
Actions
Authored by
•
MZMcBride
on May 5 2016, 9:13 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F3970878:
May 5 2016, 9:13 PM
2016-05-05 21:13:40 (UTC+0)
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'
Event Timeline
•
MZMcBride
created this paste.
May 5 2016, 9:13 PM
2016-05-05 21:13:40 (UTC+0)
Log In to Comment