# create a base url for the api and then a normal url which is initially
# just a copy of it
# The following line is what the requests call is doing, basically.
# create a base url for the api and then a normal url which is initially
# just a copy of it
# The following line is what the requests call is doing, basically.
wp_api_url = "http://en.wikipedia.org/w/api.php/"
parameters = {'action' : 'query',
wp_api_url = "http://en.wikipedia.org/w/api.php/"
parameters = {'action' : 'query',
# for every revision, first we do some cleaning up
for rev in query_revisions:
# for every revision, first we do some cleaning up
for rev in query_revisions:
#
# The following requests call basically does the same thing as this string:
# "http://tools.wmflabs.org/catscan2/catscan2.php?depth=10&categories={0}&doit=1&format=json".format(category)
#
# The following requests call basically does the same thing as this string:
# "http://tools.wmflabs.org/catscan2/catscan2.php?depth=10&categories={0}&doit=1&format=json".format(category)
# open a file to write all the output
output = open("hp_wiki.tsv", "w", encoding="utf-8")
# open a file to write all the output
output = open("hp_wiki.tsv", "w", encoding="utf-8")
# get the list of revisions from our function and then iterate through it,
# printing it to our output file
# get the list of revisions from our function and then iterate through it,
# printing it to our output file