class_docstr: Geocoder using the Bing Maps Locations API.
  
  Documentation at:
      https://msdn.microsoft.com/en-us/library/ff701715.aspx
class_docstr_tok: ["Geocoder","using","the","Bing","Maps","Locations","API",".","Documentation","at",":","https",":","\/\/msdn.microsoft.com\/en-us\/library\/ff701715.aspx"]
docstr: Parse a location name, latitude, and longitude from an JSON response.
docstr_tok: ["Parse","a","location","name",",","latitude",",","and","longitude","from","an","JSON","response","."]
code: def _parse_json(self, doc, exactly_one=True):
      """
      Parse a location name, latitude, and longitude from an JSON response.
      """
      status_code = doc.get("statusCode", 200)
      if status_code != 200:
          err = doc.get("errorDetails", "")
          if status_code == 401:
              raise GeocoderAuthenticationFailure(err)
          elif status_code == 403:
              raise GeocoderInsufficientPrivileges(err)
          elif status_code == 429:
              raise GeocoderRateLimited(err)
          elif status_code == 503:
              raise GeocoderUnavailable(err)
          else:
              raise GeocoderServiceError(err)
  
      resources = doc["resourceSets"][0]["resources"]
      if resources is None or not len(resources):
          return None
  
      def parse_resource(resource):
          """
          Parse each return object.
          """
          stripchars = ", \n"
          addr = resource["address"]
  
          address = addr.get("addressLine", "").strip(stripchars)
          city = addr.get("locality", "").strip(stripchars)
          state = addr.get("adminDistrict", "").strip(stripchars)
          zipcode = addr.get("postalCode", "").strip(stripchars)
          country = addr.get("countryRegion", "").strip(stripchars)
  
          city_state = join_filter(", ", [city, state])
          place = join_filter(" ", [city_state, zipcode])
          location = join_filter(", ", [address, place, country])
  
          latitude = resource["point"]["coordinates"][0] or None
          longitude = resource["point"]["coordinates"][1] or None
          if latitude and longitude:
              latitude = float(latitude)
              longitude = float(longitude)
  
          return Location(location, (latitude, longitude), resource)
  
      if exactly_one:
          return parse_resource(resources[0])
      else:
          return [parse_resource(resource) for resource in resources]
  
file_path: geopy/geopy/geocoders/bing.py
imports: import collections.abc
  from functools import partial
  from urllib.parse import quote, urlencode
  from geopy.exc import GeocoderAuthenticationFailure, GeocoderInsufficientPrivileges, GeocoderRateLimited, GeocoderServiceError, GeocoderUnavailable
  from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
  from geopy.location import Location
  from geopy.util import join_filter, logger
label_desc: Use image node_id 4 for calling the Bing obj's underlying member method code with example usage: obj._parse_json(doc, exactly_one) and returns: None, Location, parse_resource, unknown