3 # ?action=query&titles=Albert%20Einstein&prop=categories
4 # Get the list of categories for the Albert Einstein article.
6 parameters = {'action' : 'query',
7 'titles' : 'Albert Einstein',
13 wp_call = requests.get('http://en.wikipedia.org/w/api.php', params=parameters)
14 response = wp_call.json()
16 for page_id in response["query"]["pages"].keys():
17 for category in response["query"]["pages"][page_id]['categories']:
18 print(category['title'])
20 if 'continue' in response:
21 parameters.update(response['continue'])