carterskrive
Joined: 01/12/2021 01:38:03
Messages: 1
Offline
|
I recently encountered a discrepancy between what the GeoNames Child JSON endpoints `totalResultsCount` value and my own calculation of the result count.
Example URL (you will need to add your own <username>:
http://api.geonames.org/childrenJSON?geonameId=7052790&username=<username>
In the example URL above you can see I am told that "totalResultsCount" = 233
However, looping the "geonames" list results in only 200 results.
I am wondering if data is missing or is the count just off?
I will post the Python code below if you want to also count the total results yourself! Again you will need to enter your own <username>.
Thanks!
--------------- Python Code ----------------------
import sys
import importlib
import requests
import json
endpoint = 'http://api.geonames.org/childrenJSON?geonameId=7052912&username=<username>'
endpointDict = requests.get(endpoint).json()
print(endpointDict['totalResultsCount'])
print(len(endpointDict['geonames']))
----------------------------------------------------
|