class_docstr: GeoNames geocoder.
  
  Documentation at:
      http://www.geonames.org/export/geonames-search.html
  
  Reverse geocoding documentation at:
      http://www.geonames.org/export/web-services.html#findNearbyPlaceName
class_docstr_tok: ["GeoNames","geocoder",".","Documentation","at",":","http",":","\/\/www.geonames.org\/export\/geonames-search.html","Reverse","geocoding","documentation","at",":","http",":","\/\/www.geonames.org\/export\/web-services.html","#","findNearbyPlaceName"]
docstr: Parse JSON response body.
docstr_tok: ["Parse","JSON","response","body","."]
code: def _parse_json(self, doc, exactly_one):
      """
      Parse JSON response body.
      """
      places = doc.get("geonames", [])
      self._raise_for_error(doc)
      if not len(places):
          return None
  
      def parse_code(place):
          """
          Parse each record.
          """
          latitude = place.get("lat", None)
          longitude = place.get("lng", None)
          if latitude and longitude:
              latitude = float(latitude)
              longitude = float(longitude)
          else:
              return None
  
          placename = place.get("name")
          state = place.get("adminName1", None)
          country = place.get("countryName", None)
  
          location = ", ".join(
              [x for x in [placename, state, country] if x]
          )
  
          return Location(location, (latitude, longitude), place)
  
      if exactly_one:
          return parse_code(places[0])
      else:
          return [parse_code(place) for place in places]
  
file_path: geopy/geopy/geocoders/geonames.py
imports: from functools import partial
  from urllib.parse import urlencode
  from geopy.exc import GeocoderAuthenticationFailure, GeocoderInsufficientPrivileges, GeocoderQueryError, GeocoderQuotaExceeded, GeocoderServiceError
  from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
  from geopy.location import Location
  from geopy.timezone import ensure_pytz_is_installed, from_fixed_gmt_offset, from_timezone_name
  from geopy.util import logger
label_desc: Use image node_id 9 for calling the GeoNames obj's underlying member method code with example usage: obj._parse_json(doc, exactly_one) and returns: None, Location, parse_code, unknown, None