[meteofrance] fix #1390
This commit is contained in:
parent
148089329d
commit
e085810efa
1 changed files with 5 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ from weboob.tools.json import json as simplejson
|
||||||
from weboob.capabilities.weather import City
|
from weboob.capabilities.weather import City
|
||||||
|
|
||||||
from .pages.meteo import WeatherPage
|
from .pages.meteo import WeatherPage
|
||||||
|
import re
|
||||||
|
|
||||||
__all__ = ['MeteofranceBrowser']
|
__all__ = ['MeteofranceBrowser']
|
||||||
|
|
||||||
|
|
@ -52,9 +52,11 @@ class MeteofranceBrowser(BaseBrowser):
|
||||||
|
|
||||||
def parse_cities_result(self, datas):
|
def parse_cities_result(self, datas):
|
||||||
cities = simplejson.loads(datas.read(), self.ENCODING)
|
cities = simplejson.loads(datas.read(), self.ENCODING)
|
||||||
|
re_id = re.compile('\d{5}', re.DOTALL)
|
||||||
for city in cities:
|
for city in cities:
|
||||||
mcity = City(int(city['codePostal']), u'%s' % city['slug'])
|
if re_id.match(city['codePostal']):
|
||||||
yield mcity
|
mcity = City(int(city['codePostal']), u'%s' % city['slug'])
|
||||||
|
yield mcity
|
||||||
|
|
||||||
def iter_forecast(self, city_id):
|
def iter_forecast(self, city_id):
|
||||||
mcity = self.iter_city_search(city_id).next()
|
mcity = self.iter_city_search(city_id).next()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue