#NEWLINE# def geocode( self , query , exactly_one = True , user_location = None , timeout = None , culture = None , include_neighborhood = None , include_country_code = False ) : #NEWLINE# #INDENT# "\n        Geocode an address.\n\n        :param string query: The address or query you wish to geocode.\n\n            For a structured query, provide a dictionary whose keys\n            are one of: `addressLine`, `locality` (city), `adminDistrict` (state), `countryRegion`, or\n            `postalcode`.\n\n        :param bool exactly_one: Return one result or a list of results, if\n            available.\n\n        :param user_location: Prioritize results closer to\n            this location.\n\n            .. versionadded:: 0.96\n\n        :type user_location: :class:`geopy.point.Point`\n\n        :param int timeout: Time, in seconds, to wait for the geocoding service\n            to respond before raising a :class:`geopy.exc.GeocoderTimedOut`\n            exception. Set this only if you wish to override, on this call\n            only, the value set during the geocoder's initialization.\n\n            .. versionadded:: 0.97\n\n        :param string culture: Affects the language of the response,\n            must be a two-letter country code.\n\n            .. versionadded:: 1.4.0\n\n        :param boolean include_neighborhood: Sets whether to include the\n            neighborhood field in the response.\n\n            .. versionadded:: 1.4.0\n\n        :param boolean include_country_code: Sets whether to include the\n            two-letter ISO code of the country in the response (field name\n            'countryRegionIso2').\n\n            .. versionadded:: 1.4.0\n        " #NEWLINE# if isinstance ( query , dict ) : #NEWLINE# #INDENT# params = { key : val for ( key , val ) in query . items ( ) if ( key in self . structured_query_params ) } #NEWLINE# params [ 'key' ] = self . api_key #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# 'query' : ( self . format_string % query ) , #NEWLINE# 'key' : self . api_key , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if user_location : #NEWLINE# #INDENT# params [ 'userLocation' ] = ',' . join ( ( str ( user_location . latitude ) , str ( user_location . longitude ) ) ) #NEWLINE# #UNINDENT# if ( exactly_one is True ) : #NEWLINE# #INDENT# params [ 'maxResults' ] = 1 #NEWLINE# #UNINDENT# if culture : #NEWLINE# #INDENT# params [ 'culture' ] = culture #NEWLINE# #UNINDENT# if ( include_neighborhood is not None ) : #NEWLINE# #INDENT# params [ 'includeNeighborhood' ] = include_neighborhood #NEWLINE# #UNINDENT# if include_country_code : #NEWLINE# #INDENT# params [ 'include' ] = 'ciso2' #NEWLINE# #UNINDENT# url = '?' . join ( ( self . api , urlencode ( params ) ) ) #NEWLINE# logger . debug ( '%s.geocode: %s' , self . __class__ . __name__ , url ) #NEWLINE# return self . _parse_json ( self . _call_geocoder ( url , timeout = timeout ) , exactly_one )