@cache
def geosearch(latitude, longitude, title=None, results=10, radius=1000):
 search_params = {u'list': u'geosearch', u'gsradius': radius, u'gscoord': u'{0}|{1}'.format(latitude, longitude), u'gslimit': results}
 if title:
  search_params[u'titles'] = title
 raw_results = _wiki_request(search_params)
 if (u'error' in raw_results):
  if (raw_results[u'error'][u'info'] in (u'HTTP request timed out.', u'Pool queue is full')):
   raise HTTPTimeoutError(u'{0}|{1}'.format(latitude, longitude))
  else:
   raise WikipediaException(raw_results[u'error'][u'info'])
 search_pages = raw_results[u'query'].get(u'pages', None)
 if search_pages:
  search_results = (v[u'title'] for (k, v) in search_pages.items() if (k != u'-1'))
 else:
  search_results = (d[u'title'] for d in raw_results[u'query'][u'geosearch'])
 return list(search_results)

@ cache def geosearch ( latitude , longitude , title = None , results = 10 , radius = 1000 ) : search_params = { u'list' : u'geosearch' , u'gsradius' : radius , u'gscoord' : u'{0}|{1}' . format ( latitude , longitude ) , u'gslimit' : results } if title : search_params [ u'titles' ] = title raw_results = _wiki_request ( search_params ) if ( u'error' in raw_results ) : if ( raw_results [ u'error' ] [ u'info' ] in ( u'HTTP request timed out.' , u'Pool queue is full' ) ) : raise HTTPTimeoutError ( u'{0}|{1}' . format ( latitude , longitude ) ) else : raise WikipediaException ( raw_results [ u'error' ] [ u'info' ] ) search_pages = raw_results [ u'query' ] . get ( u'pages' , None ) if search_pages : search_results = ( v [ u'title' ] for ( k , v ) in search_pages . items ( ) if ( k != u'-1' ) ) else : search_results = ( d [ u'title' ] for d in raw_results [ u'query' ] [ u'geosearch' ] ) return list ( search_results )
do a wikipedia geo search for latitude and longitude using http api described in URL arguments: * latitude * longitude keyword arguments: * title - the title of an article to search for * results - the maximum number of results returned * radius - search radius in meters .