Skip to content

Instantly share code, notes, and snippets.

@he7d3r
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save he7d3r/ce721c9be49d40535368 to your computer and use it in GitHub Desktop.
Save he7d3r/ce721c9be49d40535368 to your computer and use it in GitHub Desktop.
"""
Prints the rev_id, characters and hash of some recent revisions
"""
import os
import sys
try:
sys.path.insert(0, os.path.abspath(os.getcwd()))
from mw import api
except:
raise
api_session = api.Session("https://pt.wikipedia.org/w/api.php")
changes = api_session.recent_changes.query(
properties={'ids', 'sha1'},
direction="older",
limit=10
)
for change in changes:
print(
"{0} ({1} chars): {2}".format(
change['revid'],
len(change.get('*', "")),
change.get('sha1', "")
)
)
$ python demonstrate_rc.py
39753618 (0 chars): 9a233f038c5f692efb3f0fbff7f4ced8a8c22cb0
40663045 (0 chars): 1f0c550dceb5c542dfb304e5d6337c063aaa3c48
34693351 (0 chars): 479dc3b4d6397134ce9d53e84c2fea0f451c1ae9
34764900 (0 chars): f23ac498773c3a74037ba7f91e68653fa8fa5809
40663042 (0 chars): 4416ce970a3a1bc1b2e1f1638cb716f9bf91c9fa
0 (0 chars):
36949986 (0 chars): 0f3919a4a56b1071087a09dce780a75374e216c6
0 (0 chars):
40659670 (0 chars): 9c1a70783ec78719d16533106816c76887fd139f
40663046 (0 chars): 11cfe5d3ebd1da4572c2e191d6be7966f0c0c9e5
$ python demonstrate_rc.py
40894574 (0 chars): 75872b007ac6b498d37415dfb49b312d820fa33a
40894573 (0 chars): 1d9578d040dc3f4df275c29214ef72002c89dcd0
40894572 (0 chars): d61affd1afe2d0bd92a3d5830aee6cdc0f4c1fe2
40894571 (0 chars): c0c824698558d871bc45389f8ea872269f55c08e
40894570 (0 chars): c5a6cfd64af9145de3df8d7ac2dd80377fcae35d
40894569 (0 chars): 33e6c65b6df0d867345020ef863dbc59f3a30b8c
38535016 (0 chars): 6ec421e6c8911043e125250788f802db069cb336
40894561 (0 chars): 775cf01d96ffa8bba4713fbd487e29c0e586fd18
40894568 (0 chars): c8ee0901d2486ae857d428c98fa0fe0be78d810b
40894567 (0 chars): 7679b3ed1509f9b6e861dfb13481c0f17d40095f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment