def woeid_search(query):
 query = (u'q=select * from geo.places where text="%s"' % query)
 body = web.get((u'http://query.yahooapis.com/v1/public/yql?' + query), dont_decode=True)
 parsed = xmltodict.parse(body).get(u'query')
 results = parsed.get(u'results')
 if ((results is None) or (results.get(u'place') is None)):
  return None
 if (type(results.get(u'place')) is list):
  return results.get(u'place')[0]
 return results.get(u'place')

def woeid_search ( query ) : query = ( u'q=select * from geo.places where text="%s"' % query ) body = web . get ( ( u'http://query.yahooapis.com/v1/public/yql?' + query ) , dont_decode = True ) parsed = xmltodict . parse ( body ) . get ( u'query' ) results = parsed . get ( u'results' ) if ( ( results is None ) or ( results . get ( u'place' ) is None ) ) : return None if ( type ( results . get ( u'place' ) ) is list ) : return results . get ( u'place' ) [ 0 ] return results . get ( u'place' )
find the first where on earth id for the given query .