Exemple #1
0
def geo_lookup( addr, lang='en' ):
    '''
    geo_lookup( address, language ) -> JSON feedback <type 'dict'>

    Parameters:
        addr: address in string
        lang: (Optional) desired language code in string
            see http://goo.gl/Xj4Nx for details
    '''
    url = util.norm_url( API_URL + OUTPUT_FORMAT, address=addr, language=lang, sensor=False )
    handler = util.open_url(url)

    return util.get_json(handler)
Exemple #2
0
def find_place( **params ):
    '''
    Stub doc
    '''

    # TODO: validate location and radius types and values
    
    url = util.norm_url( API_URL + OUT_FORMAT, ['key', API_KEY], **params )
    res = util.open_url(url)
    j = util.get_json(res)

    res.close()

    return j
Exemple #3
0
def reverse_lookup( lat, lng, lang='en' ):
    '''
    reverse_lookup( lat, lng, lang ) -> JSON feedback <type 'dict'>

    Parameters:
        lat: latitude in float or str
        lng: longitude in float or str
        lang: (Optional) desired language code in string
            see http://goo.gl/Xj4Nx for details
    '''
    ll = str(lat) + ',' + str(lng)
    url = util.norm_url( API_URL + OUTPUT_FORMAT, latlng=ll, sensor=False )
    handler = util.open_url(url)

    return util.get_json(handler)