Copied from RT
I am using the link below to get the descendants of diabetes. At the end of
the link it shows that this page had total 78 id's and 4 pages and the
current page is only showing 20 elements (data for 20 id's)
},
"page" : {
"size" : 20,
"totalElements" : 78,
"totalPages" : 4,
"number" : 0
}
}
https://www.ebi.ac.uk/ols/api/ontologies/efo/terms/http%253A%252F%252Fwww.ebi.ac.uk%252Fefo%252FEFO_0000400/descendants
.
I used the following python script for getting all the pages and elements
at one go
import requests
des = {'page':0, 'size': 78}
data = requests.get('https://www.ebi.ac.uk/ols/api/ontologies/efo/terms/http%253A%252F%252Fwww.ebi.ac.uk%252Fefo%252FEFO_0000400/descendants',
params=des)
data.json()
The above script gave all the pages in one json file. But the issue is that
I have to check every time *totalElement *(as the database will keep
updating) before running the script, which is not ideal for the automation
process.
Is there any way the script can automatically detect the totalElements and
use that in the size of the step* des = {'page':0, 'size': 78}?*
Copied from RT
I am using the link below to get the descendants of diabetes. At the end of
the link it shows that this page had total 78 id's and 4 pages and the
current page is only showing 20 elements (data for 20 id's)
},
"page" : {
"size" : 20,
"totalElements" : 78,
"totalPages" : 4,
"number" : 0
}
}
https://www.ebi.ac.uk/ols/api/ontologies/efo/terms/http%253A%252F%252Fwww.ebi.ac.uk%252Fefo%252FEFO_0000400/descendants
.
I used the following python script for getting all the pages and elements
at one go
import requests
des = {'page':0, 'size': 78}
data = requests.get('https://www.ebi.ac.uk/ols/api/ontologies/efo/terms/http%253A%252F%252Fwww.ebi.ac.uk%252Fefo%252FEFO_0000400/descendants',
params=des)
data.json()
The above script gave all the pages in one json file. But the issue is that
I have to check every time *totalElement *(as the database will keep
updating) before running the script, which is not ideal for the automation
process.
Is there any way the script can automatically detect the totalElements and
use that in the size of the step* des = {'page':0, 'size': 78}?*