The problem is that there are multiple revision IDs and it only takes one revision ID no matter how many ever revisions are present. Using Dictionary along with JSON.
Need to fetch all revision tags present.
Data Structure:Structure of the JSON file
Code:
#Defining a blank dictionary
data = {}
#File Loading Command
with open(path+filename,encoding="iso-8859-1") as file:
data = json.load(file)
#Defining the Base Date to subtract from
basedate = date(2006, 1, 1)
#Number of Objects in JSON
for count in range(140):
#If there is any data in that then do the following
if(data[count]):
for each_item in data[count]:
#If the item is revision
if each_item == "revision":
#This is where the problem lies since it always only fetches one revision
time = data[count]["revision"]["timestamp"]
currentdate = date(int(time[0:4]),int(time[5:7]),int(time[8:10]))
#Calculating Days
delta = currentdate - basedate
print(data[count]["title"] + ": " +str(delta))
==================================Edit 1================================
The JSON is pretty big to display here, hence: https://api.myjson.com/bins/4sxm3