class_docstr: Geocoder using Photon geocoding service (data based on OpenStreetMap
  and service provided by Komoot on https://photon.komoot.io).
  
  Documentation at:
      https://github.com/komoot/photon
  
  Photon/Komoot geocoder aims to let you `search as you type with
  OpenStreetMap`. No API Key is needed by this platform.
  
  .. versionchanged:: 2.2
      Changed default domain from ``photon.komoot.de``
      to ``photon.komoot.io``.
class_docstr_tok: ["Geocoder","using","Photon","geocoding","service","(","data","based","on","OpenStreetMap","and","service","provided","by","Komoot","on","https",":","\/\/photon.komoot.io",")",".","Documentation","at",":","https",":","\/\/github.com\/komoot\/photon","Photon\/Komoot","geocoder","aims","to","let","you","`","search","as","you","type","with","OpenStreetMap","`",".","No","API","Key","is","needed","by","this","platform",".","..","versionchanged",":",":","2.2","Changed","default","domain","from","``","photon.komoot.de","``","to","``","photon.komoot.io","``","."]
docstr: Return a location point by address.
  
  :param str query: The address or query you wish to geocode.
  
  :param bool exactly_one: Return one result or a list of results, if
      available.
  
  :param int timeout: Time, in seconds, to wait for the geocoding service
      to respond before raising a :class:`geopy.exc.GeocoderTimedOut`
      exception. Set this only if you wish to override, on this call
      only, the value set during the geocoder's initialization.
  
  :param location_bias: The coordinates to use as location bias.
  :type location_bias: :class:`geopy.point.Point`, list or tuple of
      ``(latitude, longitude)``, or string
      as ``"%(latitude)s, %(longitude)s"``.
  
  :param str language: Preferred language in which to return results.
  
  :param int limit: Limit the number of returned results, defaults to no
      limit.
  
  :param osm_tag: The expression to filter (include/exclude) by key and/
      or value, str as ``'key:value'`` or list/set of str if multiple
      filters are required as ``['key:!val', '!key', ':!value']``.
  :type osm_tag: str or list or set
  
  :param bbox: The bounding box of the viewport within which
      to bias geocode results more prominently.
      Example: ``[Point(22, 180), Point(-22, -180)]``.
  
      .. versionadded:: 2.2
  :type bbox: list or tuple of 2 items of :class:`geopy.point.Point` or
      ``(latitude, longitude)`` or ``"%(latitude)s, %(longitude)s"``.
  
  :rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
      ``exactly_one=False``.
docstr_tok: ["Return","a","location","point","by","address",".",":","param","str","query",":","The","address","or","query","you","wish","to","geocode",".",":","param","bool","exactly_one",":","Return","one","result","or","a","list","of","results",",","if","available",".",":","param","int","timeout",":","Time",",","in","seconds",",","to","wait","for","the","geocoding","service","to","respond","before","raising","a",":","class",":","`","geopy.exc.GeocoderTimedOut","`","exception",".","Set","this","only","if","you","wish","to","override",",","on","this","call","only",",","the","value","set","during","the","geocoder","'s","initialization",".",":","param","location_bias",":","The","coordinates","to","use","as","location","bias",".",":","type","location_bias",":",":","class",":","`","geopy.point.Point","`",",","list","or","tuple","of","``","(","latitude",",","longitude",")","``",",","or","string","as","``","``","%","(","latitude",")","s",",","%","(","longitude",")","s","''","``",".",":","param","str","language",":","Preferred","language","in","which","to","return","results",".",":","param","int","limit",":","Limit","the","number","of","returned","results",",","defaults","to","no","limit",".",":","param","osm_tag",":","The","expression","to","filter","(","include\/exclude",")","by","key","and\/","or","value",",","str","as","``","'key",":","value","'","``","or","list\/set","of","str","if","multiple","filters","are","required","as","``","[","'key",":","!","val","'",",","'","!","key","'",",","'",":","!","value","'","]","``",".",":","type","osm_tag",":","str","or","list","or","set",":","param","bbox",":","The","bounding","box","of","the","viewport","within","which","to","bias","geocode","results","more","prominently",".","Example",":","``","[","Point","(","22",",","180",")",",","Point","(","-22",",","-180",")","]","``",".","..","versionadded",":",":","2.2",":","type","bbox",":","list","or","tuple","of","2","items","of",":","class",":","`","geopy.point.Point","`","or","``","(","latitude",",","longitude",")","``","or","``","``","%","(","latitude",")","s",",","%","(","longitude",")","s","''","``",".",":","rtype",":","``","None","``",",",":","class",":","`","geopy.location.Location","`","or","a","list","of","them",",","if","``","exactly_one=False","``","."]
code: def geocode(
      self,
      query,
      *,
      exactly_one=True,
      timeout=DEFAULT_SENTINEL,
      location_bias=None,
      language=False,
      limit=None,
      osm_tag=None,
      bbox=None,
  ):
      """
      Return a location point by address.
  
      :param str query: The address or query you wish to geocode.
  
      :param bool exactly_one: Return one result or a list of results, if
          available.
  
      :param int timeout: Time, in seconds, to wait for the geocoding service
          to respond before raising a :class:`geopy.exc.GeocoderTimedOut`
          exception. Set this only if you wish to override, on this call
          only, the value set during the geocoder's initialization.
  
      :param location_bias: The coordinates to use as location bias.
      :type location_bias: :class:`geopy.point.Point`, list or tuple of
          ``(latitude, longitude)``, or string
          as ``"%(latitude)s, %(longitude)s"``.
  
      :param str language: Preferred language in which to return results.
  
      :param int limit: Limit the number of returned results, defaults to no
          limit.
  
      :param osm_tag: The expression to filter (include/exclude) by key and/
          or value, str as ``'key:value'`` or list/set of str if multiple
          filters are required as ``['key:!val', '!key', ':!value']``.
      :type osm_tag: str or list or set
  
      :param bbox: The bounding box of the viewport within which
          to bias geocode results more prominently.
          Example: ``[Point(22, 180), Point(-22, -180)]``.
  
          .. versionadded:: 2.2
      :type bbox: list or tuple of 2 items of :class:`geopy.point.Point` or
          ``(latitude, longitude)`` or ``"%(latitude)s, %(longitude)s"``.
  
      :rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
          ``exactly_one=False``.
  
      """
      params = {"q": query}
      if limit:
          params["limit"] = int(limit)
      if exactly_one:
          params["limit"] = 1
      if language:
          params["lang"] = language
      if location_bias:
          try:
              lat, lon = self._coerce_point_to_string(
                  location_bias
              ).split(",")
              params["lon"] = lon
              params["lat"] = lat
          except ValueError:
              raise ValueError(
                  "Location bias must be a coordinate pair or Point"
              )
  
      if bbox:
          params["bbox"] = self._format_bounding_box(
              bbox, "%(lon1)s,%(lat1)s,%(lon2)s,%(lat2)s"
          )
  
      if osm_tag:
          if isinstance(osm_tag, str):
              params["osm_tag"] = [osm_tag]
          else:
              if not isinstance(osm_tag, collections.abc.Iterable):
                  raise ValueError(
                      "osm_tag must be a string or "
                      "an iterable of strings"
                  )
              params["osm_tag"] = list(osm_tag)
      url = "?".join((self.api, urlencode(params, doseq=True)))
      logger.debug("%s.geocode: %s", self.__class__.__name__, url)
      callback = partial(self._parse_json, exactly_one=exactly_one)
      return self._call_geocoder(url, callback, timeout=timeout)
  
file_path: geopy/geopy/geocoders/photon.py
imports: import collections.abc
  from functools import partial
  from urllib.parse import urlencode
  from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
  from geopy.location import Location
  from geopy.util import logger
label_desc: Use image node_id 2 for calling the Photon obj's underlying member method code with example usage: obj.geocode(query) and returns: self