def get_woeid(location):
    query = urllib.quote(location, '')
    
    values = {
        'app_id': YAHOO_APP_ID,
        'query': query,
    }
    url = WHERE_API_QUERY_URL % values
    response = requests.get(url)
    data = json.loads(response.text)
    try:
        places = data['places']
        if places['count'] > 0:
            place = places['place'][0]
            woeid = place['woeid']
        else:
            woeid = None
    except __HOLE__, k:
        woeid = None
    return woeid
dataset/ETHPy150Open hacktoolkit/hacktoolkit/apis/yahoo/geo/geoplanet/geoplanet.py/get_woeid