Beispiel #1
0
    def update_origin_account(self, origin_account):
        for account in self.doc.xpath('//ul[@id="idCptFrom"]//li'):
            # get all account data
            data = Attr('.', 'data-comptecomplet')(account)
            json_data = json.loads(data.replace('"', '"'))

            if (origin_account.label == CleanText().filter(
                    json_data['libelleCompte'])
                    and origin_account.iban == json_data['ibanCompte']):
                origin_account._currency_code = json_data['codeDevise']
                origin_account._formatted_iban = json_data['ibanFormateCompte']
                origin_account._min_amount = json_data['montantMin']
                origin_account._max_amount = json_data['montantMax']
                origin_account._decimal_code = json_data['codeDecimal']
                origin_account._manage_counter = json_data[
                    'guichetGestionnaire']
                origin_account._account_title = json_data['intituleCompte']
                origin_account._bic = json_data['bicCompte']
                origin_account._id_service = json_data['idPrestation']
                origin_account._product_code = json_data['codeProduit']
                origin_account._underproduct_code = json_data[
                    'codeSousProduit']
                break
        else:
            # some accounts are not able to do transfer
            self.logger.warning('Account %s not found on transfer page',
                                origin_account.label)
Beispiel #2
0
 def obj_photos(self):
     photos = []
     for photo in self.xpath('//div[has-class("OfferSlider")]//img'):
         photo_url = Attr('.', 'src')(photo)
         photo_url = photo_url.replace('640/480', '800/600')
         photos.append(HousingPhoto(photo_url))
     return photos
Beispiel #3
0
 def obj_photos(self):
     photos = []
     for photo in self.xpath('//div[has-class("OfferSlider")]//img'):
         photo_url = Attr('.', 'src')(photo)
         photo_url = photo_url.replace('640/480', '800/600')
         photos.append(HousingPhoto(photo_url))
     return photos
Beispiel #4
0
    def update_origin_account(self, origin_account):
        for account in self.doc.xpath('//ul[@id="idCptFrom"]//li'):
            # get all account data
            data = Attr('.', 'data-comptecomplet')(account)
            json_data = json.loads(data.replace('"', '"'))

            if (
                origin_account.label == CleanText().filter(json_data['libelleCompte'])
                and origin_account.iban == json_data['ibanCompte']
            ):
                origin_account._currency_code = json_data['codeDevise']
                origin_account._formatted_iban = json_data['ibanFormateCompte']
                origin_account._min_amount = json_data['montantMin']
                origin_account._max_amount = json_data['montantMax']
                origin_account._decimal_code = json_data['codeDecimal']
                origin_account._manage_counter = json_data['guichetGestionnaire']
                origin_account._account_title = json_data['intituleCompte']
                origin_account._bic = json_data['bicCompte']
                origin_account._id_service = json_data['idPrestation']
                origin_account._product_code = json_data['codeProduit']
                origin_account._underproduct_code = json_data['codeSousProduit']
                break
        else:
            # some accounts are not able to do transfer
            self.logger.warning('Account %s not found on transfer page', origin_account.label)
Beispiel #5
0
 def obj_thumbnail(self):
     style = Attr(
         './/a[has-class("bu_cuisine_recette_img")]/span',
         'style')(self)
     return Thumbnail(
         style.replace("background-image:url(",
                       "").rstrip(");"))
Beispiel #6
0
    def login(self, login, password, captcha_response=None):
        maxlength = int(
            Attr('//input[@id="Email"]', 'data-val-maxlength-max')(self.doc))
        regex = Attr('//input[@id="Email"]',
                     'data-val-regex-pattern')(self.doc)
        # their regex is: ^([\w\-+\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,15}|[0-9]{1,3})(\]?)$
        # but it is not very good, we escape - inside [] to avoid bad character range Exception
        regex = regex.replace('[\w-+\.]', '[\w\-+\.]')

        if len(login) > maxlength:  # actually it's 60 char
            raise BrowserIncorrectPassword(
                Attr('//input[@id="Email"]', 'data-val-maxlength')(self.doc))

        if not re.match(regex, login):
            raise BrowserIncorrectPassword(
                Attr('//input[@id="Email"]', 'data-val-regex')(self.doc))

        form = self.get_form(xpath='//form[contains(@action, "/Login/Login")]')
        form['Email'] = login
        form['Password'] = password

        if captcha_response:
            form['g-recaptcha-response'] = captcha_response

        form.submit()
Beispiel #7
0
 def obj_photos(self):
     photos = []
     url = Attr('.//div[has-class("offer-picture")]//img',
                'src')(self)
     if url:
         url = url.replace('400x267', '800x600')
         url = urljoin(self.page.url, url)  # Ensure URL is absolute
         photos.append(HousingPhoto(url))
     return photos
Beispiel #8
0
 def obj_photos(self):
     photos = []
     url = Attr(
         './div[@class="item_image"]/span/span[@class="lazyload"]',
         'data-imgsrc',
         default=None)(self)
     if url:
         photos.append(
             HousingPhoto(url.replace("ad-thumb", "ad-image")))
     return photos
Beispiel #9
0
 def obj_photos(self):
     photos = []
     url = Attr(
         './/div[has-class("offer-picture")]//img',
         'src'
     )(self)
     if url:
         url = url.replace('400x267', '800x600')
         url = urljoin(self.page.url, url)  # Ensure URL is absolute
         photos.append(HousingPhoto(url))
     return photos
Beispiel #10
0
    def login(self, login, password):
        maxlength = Attr('//input[@id="Email"]', 'data-val-maxlength-max')(self.doc)
        regex = Attr('//input[@id="Email"]', 'data-val-regex-pattern')(self.doc)
        # their regex is: ^([\w\-+\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,15}|[0-9]{1,3})(\]?)$
        # but it is not very good, we escape - inside [] to avoid bad character range Exception
        regex = regex.replace('[\w-+\.]', '[\w\-+\.]')

        if len(login) > maxlength:  # actually it's 60 char
            raise BrowserIncorrectPassword(Attr('//input[@id="Email"]', 'data-val-maxlength')(self.doc))

        if not re.match(regex, login):
            raise BrowserIncorrectPassword(Attr('//input[@id="Email"]', 'data-val-regex')(self.doc))

        form = self.get_form(xpath='//form[contains(@action, "/Login/Login")]')
        form['Email'] = login
        form['Password'] = password
        form.submit()
Beispiel #11
0
    def iter_internal_recipients(self):
        if self.doc.xpath('//ul[@id="idCmptToInterne"]'):
            for account in self.doc.xpath('//ul[@id="idCmptToInterne"]/li'):
                data = Attr('.', 'data-comptecomplet')(account)
                json_data = json.loads(data.replace('"', '"'))

                rcpt = Recipient()
                rcpt.category = 'Interne'
                rcpt.id = rcpt.iban = json_data['ibanCompte']
                rcpt.label = json_data['libelleCompte']
                rcpt.enabled_at = date.today()

                rcpt._formatted_iban = json_data['ibanFormateCompte']
                rcpt._account_title = json_data['intituleCompte']
                rcpt._bic = json_data['bicCompte']
                rcpt._ref = ''
                rcpt._code_origin = ''
                rcpt._created_date = ''

                yield rcpt
Beispiel #12
0
    def iter_internal_recipients(self):
        if self.doc.xpath('//ul[@id="idCmptToInterne"]'):
            for account in self.doc.xpath('//ul[@id="idCmptToInterne"]/li'):
                data = Attr('.', 'data-comptecomplet')(account)
                json_data = json.loads(data.replace('"', '"'))

                rcpt = Recipient()
                rcpt.category = 'Interne'
                rcpt.id = rcpt.iban = json_data['ibanCompte']
                rcpt.label = json_data['libelleCompte']
                rcpt.enabled_at = date.today()

                rcpt._formatted_iban = json_data['ibanFormateCompte']
                rcpt._account_title = json_data['intituleCompte']
                rcpt._bic = json_data['bicCompte']
                rcpt._ref = ''
                rcpt._code_origin = ''
                rcpt._created_date = ''

                yield rcpt
Beispiel #13
0
 def obj_thumbnail(self):
     style = Attr(
         './/a[has-class("bu_cuisine_recette_img")]/span',
         'style'
     )(self)
     return Thumbnail(style.replace("background-image:url(", "").rstrip(");"))