Skip to content

Instantly share code, notes, and snippets.

@bitnik
Last active November 21, 2017 15:48
Show Gist options
  • Save bitnik/94c9c4e38d70dca607ccf149dfd2a354 to your computer and use it in GitHub Desktop.
Save bitnik/94c9c4e38d70dca607ccf149dfd2a354 to your computer and use it in GitHub Desktop.
How to query WikiWho API
import requests
session = requests.session()
# log in data
session.auth = ('wikiwho_api_username', 'wikiwho_api_password')
language = 'en'
wikiwho_api_base_url = 'https://api.wikiwho.net/{}/api/v1.0.0-beta/'.format(language)
# Example: get revision content by page id
page_id = 2161298
wikiwho_api_rev_content_url = '{}rev_content/page_id/{}/'.format(wikiwho_api_base_url, page_id)
# exclude ins and outs
rev_content_params = {'o_rev_id': 'true', 'editor': 'true', 'token_id': 'true', 'out': 'false', 'in': 'false'}
response = session.get(url=wikiwho_api_rev_content_url, params=rev_content_params).json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment