http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9100
Revision: 9100 Author: jayvdb Date: 2011-03-18 11:26:19 +0000 (Fri, 18 Mar 2011) Log Message: ----------- restore old API for site.recentchanges so it is equivalent to site.newpages per comment on r9089
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2011-03-18 11:23:37 UTC (rev 9099) +++ trunk/pywikipedia/wikipedia.py 2011-03-18 11:26:19 UTC (rev 9100) @@ -6334,8 +6334,13 @@
def recentchanges(self, number = 100, rcstart = None, rcend = None, rcshow = None, rcdir='older', rctype ='edit|new', namespace=None, includeredirects=True, repeat = False, user = None): """ - Yield ImagePages from APIs, call: action=query&list=recentchanges&rctype=edit|new&rclimit=500 + Yield recent changes as Page objects + uses API call: action=query&list=recentchanges&rctype=edit|new&rclimit=500
+ Starts with the newest change and fetches the number of changes + specified in the first argument. If repeat is True, it fetches + again. + Options directly from APIs: --- Parameters: @@ -6363,6 +6368,12 @@ Default: 10 rctype - Which types of changes to show. Values (separate with '|'): edit, new, log + + The objects yielded are tuples composed of the Page object, + timestamp (unicode), length (int), an empty unicode string, username + or IP address (str), comment (unicode). + + # TODO: Detection of unregistered users is broken """ if rctype is None: rctype = 'edit|new' @@ -6371,7 +6382,7 @@ 'list' : 'recentchanges', 'rcdir' : rcdir, 'rctype' : rctype, - 'rcprop' : ['user','comment','timestamp','title','ids','loginfo'], #','flags','sizes','redirect','patrolled'] + 'rcprop' : ['user','comment','timestamp','title','ids','loginfo','sizes'], #','flags','redirect','patrolled'] 'rcnamespace' : namespace, 'rclimit' : int(number), } @@ -6395,7 +6406,7 @@ if 'comment' in i: comment = i['comment'] page = Page(self, i['title'], defaultNamespace=i['ns']) - yield page, i['timestamp'], i['user'], comment, '' + yield page, i['timestamp'], i['newlen'], u'', i['user'], comment if not repeat: break
pywikipedia-svn@lists.wikimedia.org