Last active
July 28, 2017 11:28
-
-
Save panchicore/7b3fcb18282ad40ada00cedc3036cf90 to your computer and use it in GitHub Desktop.
get "[WFP] Geonames countries ID mappings" directly from python requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# source: https://docs.google.com/spreadsheets/d/18YIk3aQYdx1kIWzLAyUpTshl72P8_uFDGI_8TI2bd1k/edit#gid=0 | |
url = "https://spreadsheets.google.com/feeds/list/18YIk3aQYdx1kIWzLAyUpTshl72P8_uFDGI_8TI2bd1k/od6/public/values?alt=json" | |
res = requests.get(url) | |
res = res.json() | |
for row in res['feed']['entry']: | |
geonames_name = row['gsx$country']['$t'] | |
geonames_id = row['gsx$geonameid']['$t'] | |
geonames_id = row['gsx$geonameid']['$t'] | |
sismas_id = row['gsx$simsasid']['$t'] | |
undss_id = row['gsx$undssid']['$t'] | |
hr_name = row['gsx$hrname']['$t'] | |
wfp_region = row['gsx$wfpregion']['$t'] | |
print row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment