Exemplo n.º 1
0
        class item(ItemElement):

            klass = City

            obj_id = Dict('id') & CleanText() & Lower()

            obj_name = Dict('id') & CleanText() & Lower()
Exemplo n.º 2
0
 def get_labels(self):
     synthesis_labels = ["synthèse"]
     loan_labels = ["crédits en cours", "crédits perso et immo", "crédits", "crédits personnels et immobiliers"]
     keys = [key for key in Dict('donnees')(self.doc) if key.get('label').lower() in ['crédits', 'comptes et cartes']]
     for key in keys:
         for element in Dict('submenu')(key):
             if Lower(CleanText(Dict('label')))(element) in synthesis_labels:
                 synthesis_label = CleanText(Dict('link'))(element).split("/")[-1]
             if Lower(CleanText(Dict('label')))(element) in loan_labels:
                 loan_label = CleanText(Dict('link'))(element).split("/")[-1]
     return (synthesis_label, loan_label)
Exemplo n.º 3
0
        class item(ItemElement):
            klass = Account

            TYPES = {
                u'assurance vie': Account.TYPE_LIFE_INSURANCE,
                u'perp': Account.TYPE_PERP,
                u'epargne retraite agipi pair': Account.TYPE_PERP,
                u'novial avenir': Account.TYPE_MADELIN,
                u'epargne retraite novial': Account.TYPE_LIFE_INSURANCE,
            }

            condition = lambda self: Field('balance')(self) is not NotAvailable

            obj_id = Regexp(CleanText('.//span[has-class("small-title")]'),
                            r'([\d/]+)')
            obj_label = CleanText('.//h3[has-class("card-title")]')
            obj_balance = CleanDecimal.French('.//p[has-class("amount-card")]')
            obj_valuation_diff = CleanDecimal.French(
                './/p[@class="performance"]', default=NotAvailable)

            def obj_url(self):
                url = Attr('.', 'data-route')(self)
                # The Assurance Vie xpath recently changed so we must verify that all
                # the accounts now have "/savings/" instead of "/assurances-vie/".
                assert "/savings/" in url
                return url

            obj_currency = Currency('.//p[has-class("amount-card")]')
            obj__acctype = "investment"

            obj_type = MapIn(Lower(Field('label')), TYPES,
                             Account.TYPE_UNKNOWN)
Exemplo n.º 4
0
        class item(ItemElement):
            klass = Account

            TYPES = {
                'assurance vie': Account.TYPE_LIFE_INSURANCE,
                'perp': Account.TYPE_PERP,
                'epargne retraite agipi pair': Account.TYPE_PERP,
                'epargne retraite agipi far': Account.TYPE_MADELIN,
                'epargne retraite ma retraite': Account.TYPE_PER,
                'novial avenir': Account.TYPE_MADELIN,
                'epargne retraite novial': Account.TYPE_LIFE_INSURANCE,
            }

            obj_id = Regexp(CleanText('.//span[has-class("small-title")]'),
                            r'([\d/]+)')
            obj_number = obj_id
            obj_label = CleanText('.//h3[has-class("card-title")]')
            obj_balance = CleanDecimal.French('.//p[has-class("amount-card")]')
            obj_valuation_diff = CleanDecimal.French(
                './/p[@class="performance"]', default=NotAvailable)
            obj_currency = Currency('.//p[has-class("amount-card")]')
            obj__acctype = "investment"
            obj_type = MapIn(Lower(Field('label')), TYPES,
                             Account.TYPE_UNKNOWN)
            obj_url = Attr('.', 'data-module-open-link--link')
            obj_ownership = AccountOwnership.OWNER
Exemplo n.º 5
0
        class item(ItemElement):
            klass = Transaction

            obj_id = None  # will be overwrited by the browser
            # we use lower for compatibility with the old website
            obj_raw = Transaction.Raw(Lower('.//td[@class="lbl"]'))
            obj_amount = CleanDecimal('.//td[starts-with(@class, "amount")]', replace_dots=True)
            obj_date = INGDate(CleanText('.//td[@class="date"]'), dayfirst=True)
            obj_rdate = Field('date')
            obj__hash = PreHashmd5(Field('date'), Field('raw'), Field('amount'))
            obj_category = INGCategory(Attr('.//td[@class="picto"]/span', 'class'))

            def condition(self):
                if self.el.find('.//td[@class="date"]') is None:
                    return False
                if 'index' in self.env and self.env['index'] > 0 and self.page.i < self.env['index']:
                    self.page.i += 1
                    return False
                return True
Exemplo n.º 6
0
 def obj_raw(self):
     return Transaction.Raw(Lower('.//td[@class="lbl"]'))(self) or Format('%s %s', Field('date'), Field('amount'))(self)
Exemplo n.º 7
0
 def get_perimeter_name(self):
     return Lower(
         CleanText(
             '//div[@id="libPerimetre_2"]//span[@class="textePerimetre_2"]',
             default=''))(self.doc)
Exemplo n.º 8
0
 def obj_raw(self):
     return Transaction.Raw(Lower(Dict('label')))(self) or Format(
         '%s %s', Field('date'), Field('amount'))(self)
Exemplo n.º 9
0
        class item(ItemElement):
            klass = Gauge

            def condition(self):
                # sometimes the "date" field (which contains the hour) is empty
                # and no measure is present in it, so we discard it
                return bool(self.el['date'])

            def parse(self, el):
                for k in el:
                    self.env[k] = el[k]

                self.env['city'] = Regexp(Dict('commune'), r'^(\D+)')(self)

            obj_id = Dict('nom_court_sit')
            obj_name = Dict('isit_long')
            obj_city = Env('city')
            obj_object = 'Pollution'

            obj__searching = Lower(Format(
                '%s %s %s %s',
                Dict('isit_long'),
                Dict('commune'),
                Dict('ninsee'),
                Dict('adresse'),
            ))

            class obj_sensors(DictElement):
                def find_elements(self):
                    return [dict(zip(('key', 'value'), tup)) for tup in self.el['indices'].items()]

                class item(ItemElement):
                    klass = GaugeSensor

                    obj_name = Map(Dict('key'), SENSOR_NAMES)
                    obj_gaugeid = Env('nom_court_sit')
                    obj_id = Format('%s.%s', obj_gaugeid, Dict('key'))
                    obj_unit = 'µg/m³'

                    class obj_lastvalue(ItemElement):
                        klass = GaugeMeasure

                        obj_date = DateTime(
                            Format(
                                '%s %s',
                                Env('min_donnees'),
                                Env('date'),  # "date" contains the time...
                            )
                        )
                        obj_level = CleanDecimal(Dict('value'))

                    class obj_geo(ItemElement):
                        klass = GeoCoordinates

                        obj_latitude = CleanDecimal(Env('latitude'))
                        obj_longitude = CleanDecimal(Env('longitude'))

                    class obj_location(ItemElement):
                        klass = PostalAddress

                        obj_street = Env('adresse')
                        obj_postal_code = Env('ninsee')
                        obj_city = Env('city')
                        obj_region = 'Ile-de-France'
                        obj_country = 'France'