Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created June 13, 2013 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadamc/5776253 to your computer and use it in GitHub Desktop.
Save gadamc/5776253 to your computer and use it in GitHub Desktop.
def geoname(lat, lng, usrname):
url = 'http://api.geonames.org/countrySubdivisionJSON?lat=%f&lng=%f&username=%s' % (lat, lng, usrname)
r = requests.get(url)
r.raise_for_status() #we'll quit if we have any problems.
return r.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment