cftiger / python-weather-api

Automatically exported from code.google.com/p/python-weather-api
MIT License
0 stars 0 forks source link

get_location_ids( ) broken: can't search with embedded spaces, gives at most 10 results #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Beginning a few days ago (around 2013-10-24), get_location_ids() no longer 
works for most cities.

For instance, help(pywapi.get_location_ids) suggests using 'Los Angeles' as a 
search string. pywapi.get_location_ids("Los Angeles") gives a warning about 
'str' not being a unicode object, and returns [].
pywapi.get_location_ids(u"Los Angeles") returns [] without the warning.

The problem seems to be that the server (Yahoo?) is no longer accepting spaces 
in location names. If I truncate the name at the first space, 
pywapi.get_location_ids(u"Los") does return a list of IDs which includes 
(u'USCA0638', u'Los Angeles, CA') as the first item.

But that workaround doesn't work for all cities, because it only returns at 
most 10 results, so if you need to search for something like "Los" or "Santa" 
there's no guarantee of getting the city you want in the first 10 results.

I'm not sure if there's any solution for this (I know you don't control the 
server and this isn't pywapi's fault) but I wanted to make sure you knew about 
the problem. Maybe there's a clever workaround that I haven't found yet. I hope 
so -- pywapi is a super useful library.

This is with the pywapi currently in pip, under Debian sid and Python 2.7.5.

Original issue reported on code.google.com by akkana on 27 Oct 2013 at 4:34

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r153.

Original comment by jtas...@gmail.com on 22 Jan 2014 at 3:14