
    .h                     z    S SK Jr  S SKJr  S SKJrJrJrJrJ	r	  S SK
JrJr  S SKJr  S SKJr  Sr " S S	\5      rg
)    )partial)	urlencode)GeocoderAuthenticationFailureGeocoderQueryErrorGeocoderQuotaExceededGeocoderServiceErrorGeocoderUnavailable)DEFAULT_SENTINELGeocoder)Location)logger)Geokeoc                   z   ^  \ rS rSrSrSrSrSS\\S\SS.U 4S jjrSS	\S
.S jr	S	\S.S jr
SS jrS rSrU =r$ )r      zrGeocoder using the geokeo API.

Documentation at:
    https://geokeo.com/documentation.php

.. versionadded:: 2.4
z/geocode/v1/search.phpz/geocode/v1/reverse.phpz
geokeo.comN)domainschemetimeoutproxies
user_agentssl_contextadapter_factoryc          	        > [         T	U ]  UUUUUUS9  Xl        UR                  S5      U l        U R
                  < SU R                  < U R                  < 3U l        U R
                  < SU R                  < U R                  < 3U l	        g)a  

:param str api_key: The API key required by Geokeo.com
    to perform geocoding requests. You can get your key here:
    https://geokeo.com/

:param str domain: Domain where the target Geokeo service
    is hosted.

:param str scheme:
    See :attr:`geopy.geocoders.options.default_scheme`.

:param int timeout:
    See :attr:`geopy.geocoders.options.default_timeout`.

:param dict proxies:
    See :attr:`geopy.geocoders.options.default_proxies`.

:param str user_agent:
    See :attr:`geopy.geocoders.options.default_user_agent`.

:type ssl_context: :class:`ssl.SSLContext`
:param ssl_context:
    See :attr:`geopy.geocoders.options.default_ssl_context`.

:param callable adapter_factory:
    See :attr:`geopy.geocoders.options.default_adapter_factory`.

)r   r   r   r   r   r   /z://N)
super__init__api_keystripr   r   geocode_pathapireverse_pathreverse_api)
selfr   r   r   r   r   r   r   r   	__class__s
            iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\geopy/geocoders/geokeo.pyr   Geokeo.__init__   sz    R 	!#+ 	 	
 ll3'"&++t{{D<M<MN*.++t{{DDUDUV    T)countryexactly_oner   c                "   U R                   US.nU(       a  X%S'   SR                  U R                  [        U5      45      n[        R
                  " SU R                  R                  U5        [        U R                  US9nU R                  XgUS9$ )a  
Return a location point by address.

:param str query: The address or query you wish to geocode.

:param str country: Restricts the results to the specified
    country. The country code is a 2 character code as
    defined by the ISO 3166-1 Alpha 2 standard (e.g. ``us``).

: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.

:rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
    ``exactly_one=False``.
)r   qr'   ?z%s.geocode: %sr(   r   )r   joinr   r   r   debugr#   __name__r   _parse_json_call_geocoder)r"   queryr'   r(   r   paramsurlcallbacks           r$   geocodeGeokeo.geocodeU   s    : <<

  '9hh)F"345%t~~'>'>D4++E""3'"BBr&   )r(   r   c                    U R                  U5      R                  S5      u  pEU R                  UUS.nSR	                  U R
                  [        U5      45      n[        R                  " SU R                  R                  U5        [        U R                  US9nU R                  XxUS9$ ! [         a    [        S5      ef = f)a  
Return an address by location point.

:param query: The coordinates for which you wish to obtain the
    closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
    longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.

: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.

:rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
    ``exactly_one=False``.
,z"Must be a coordinate pair or Point)r   latlngr+   z%s.reverse: %sr,   r-   )_coerce_point_to_stringsplit
ValueErrorr   r.   r!   r   r   r/   r#   r0   r   r1   r2   )	r"   r3   r(   r   r;   r<   r4   r5   r6   s	            r$   reverseGeokeo.reverse   s    6	C33E:@@EHC
 <<
 hh(()F*;<=%t~~'>'>D4++E""3'"BB  	CABB	Cs   "B* *C c                     UR                  S/ 5      nU R                  U5        U(       d  g S nU(       a  U" US   5      $ U Vs/ s H
  oT" U5      PM     sn$ s  snf )Nresultsc                 l    U R                  S5      nU S   S   S   nU S   S   S   n[        XU4U 5      $ )z4Get the location, lat, lng from a single json place.formatted_addressgeometrylocationr;   r<   )getr   )placerG   latitude	longitudes       r$   parse_place'Geokeo._parse_json.<locals>.parse_place   sK    yy!45HZ(4U;Hj)*5e<IH&;UCCr&   r   )rH   _check_status)r"   pager(   placesrL   rI   s         r$   r1   Geokeo._parse_json   s]    )R(4 	D vay))4:;F5K&F;;;s   Ac                    UR                  S5      =(       d    SR                  5       nUS:X  a  g US:X  a  g US:X  a  [        S5      eUS:X  a  [        S5      eUS	:X  a  [	        S
5      eUS:X  a  [        S5      e[        S5      e)Nstatus OKZERO_RESULTSINVALID_REQUESTzInvalid request parametersACCESS_DENIEDzAccess deniedOVER_QUERY_LIMITzOver query limitINTERNAL_SERVER_ERRORzInternal server errorzUnknown error)rH   upperr   r   r   r	   r   )r"   rO   rS   s      r$   rN   Geokeo._check_status   s    ((8$*113 T>^#&&$%ABB&/@@))'(:;;..%&=>> '77r&   )r   r   r   r!   )T)r0   
__module____qualname____firstlineno____doc__r   r    r
   r   r7   r@   r1   rN   __static_attributes____classcell__)r#   s   @r$   r   r      sh     ,L,L  $$( 5W 5Wv $(C\ $*CX<$8 8r&   r   N)	functoolsr   urllib.parser   	geopy.excr   r   r   r   r	   geopy.geocoders.baser
   r   geopy.locationr   
geopy.utilr   __all__r    r&   r$   <module>rk      s3     "  < # 
~8X ~8r&   