[Element] create new element : DictElement
use new DictElement in modules
This commit is contained in:
parent
be122f0fa6
commit
a39dff77a5
10 changed files with 38 additions and 91 deletions
|
|
@ -21,21 +21,12 @@ from datetime import date
|
|||
from itertools import imap, ifilter
|
||||
|
||||
from weboob.browser.pages import JsonPage, HTMLPage
|
||||
from weboob.browser.elements import ItemElement, ListElement, method
|
||||
from weboob.browser.elements import ItemElement, ListElement, DictElement, method
|
||||
from weboob.capabilities.weather import Forecast, Current, City, Temperature
|
||||
from weboob.browser.filters.json import Dict
|
||||
from weboob.browser.filters.standard import Filter, CleanText, CleanDecimal, Regexp, Format, Date
|
||||
|
||||
|
||||
class DictElement(ListElement):
|
||||
def find_elements(self):
|
||||
if self.item_xpath is not None:
|
||||
for el in self.el:
|
||||
yield el
|
||||
else:
|
||||
yield self.el
|
||||
|
||||
|
||||
class Id(Filter):
|
||||
def filter(self, txt):
|
||||
return txt.split(", ")[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue