Riley_Huntley

def getCategoryList():

Dec 13th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import wikipedia
  2. import json
  3. x= raw_input("Category:")
  4. print "Category:" + x
  5. def getCategoryList():
  6. site = wikipedia.getSite()
  7. predata = {'action': 'query',
  8. 'list': 'categorymemebers',
  9. 'cmnamespace': '0',
  10. 'cmtype': 'page',
  11. 'cmlimit': '2500',
  12. 'cmprop': 'title',
  13. 'format':'json'
  14. }
  15. response, raw = site.postForm(site.apipath(), predata)
  16. result = json.loads(raw)
  17. reg = result["query"]["categorymemebers"]
  18. return reg
  19. print getCategoryList()
Advertisement
Add Comment
Please, Sign In to add comment