本文整理汇总了Python中weboob.browser.filters.standard.CleanText.startswith方法的典型用法代码示例。如果您正苦于以下问题:Python CleanText.startswith方法的具体用法?Python CleanText.startswith怎么用?Python CleanText.startswith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.browser.filters.standard.CleanText
的用法示例。
在下文中一共展示了CleanText.startswith方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def parse(self, el):
self.env['category'] = u'Interne' if Attr('.', 'value')(self)[0] == 'I' else u'Externe'
if self.env['category'] == u'Interne':
# TODO use after 'I'?
_id = Regexp(CleanText('.'), r'- (\w+\d\w+)')(self) # at least one digit
accounts = list(self.page.browser.get_accounts_list()) + list(self.page.browser.get_loans_list())
match = [acc for acc in accounts if _id in acc.id]
assert len(match) == 1
match = match[0]
self.env['id'] = match.id
self.env['iban'] = match.iban
self.env['bank_name'] = u"Caisse d'Épargne"
self.env['label'] = match.label
# Usual case
elif Attr('.', 'value')(self)[1] == '-':
full = CleanText('.')(self)
if full.startswith('- '):
self.logger.warning('skipping recipient without a label: %r', full)
raise SkipItem()
# <recipient name> - <account number or iban> - <bank name (optional)> <optional last dash>
mtc = re.match('(?P<label>.+) - (?P<id>[^-]+) -(?P<bank> [^-]*)?-?$', full)
assert mtc
self.env['id'] = self.env['iban'] = mtc.group('id')
self.env['bank_name'] = (mtc.group('bank') and mtc.group('bank').strip()) or NotAvailable
self.env['label'] = mtc.group('label')
# Fcking corner case
else:
mtc = re.match('(?P<id>.+) - (?P<label>[^-]+) -( [^-]*)?-?$', CleanText('.')(self))
assert mtc
self.env['id'] = mtc.group('id')
self.env['iban'] = NotAvailable
self.env['bank_name'] = NotAvailable
self.env['label'] = mtc.group('label')
示例2: obj_photos
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def obj_photos(self):
photos = []
for i in range(1, CleanDecimal('//NbPhotos')(self) + 1):
img = CleanText('//LienImage%s' % i, replace=[(u'w=69&h=52', u'w=786&h=481')])(self)
url = img if img.startswith('http') else u'http://www.entreparticuliers.com%s' % img
photos.append(HousingPhoto(url))
return photos
示例3: obj_url
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def obj_url(self):
url = CleanText('//meta[@property="og:url"]/@content', default=None)(self)
if url is None:
url = JSVar(CleanText('//script'), var='_JobUrl')(self)
if not url.startswith('http'):
url = 'www.adecco.fr%s' % url
return url
示例4: get_author
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def get_author(self):
try:
author = CleanText('.')(self.get_element_author())
if author.startswith('Par '):
return author.split('Par ', 1)[1]
else:
return author
except AttributeError:
return ''
示例5: on_load
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def on_load(self):
h1 = CleanText('//h1[1]')(self.doc)
if h1.startswith('Le service est moment'):
text = CleanText('//h4[1]')(self.doc) or h1
raise BrowserUnavailable(text)
if not self.browser.no_login:
raise LoggedOut()
示例6: obj_type
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def obj_type(self):
try:
el_to_check = CleanText(TableCell('type'))(self)
type_dict = self.TYPE
except ColumnNotFound:
el_to_check = Field('label')(self)
type_dict = self.TYPE_BY_LABELS
for k, v in type_dict.items():
if el_to_check.startswith(k):
return v
return Account.TYPE_UNKNOWN
示例7: obj_income
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def obj_income(self):
price = CleanText('.//span[has-class("nbPrice")]')(self)
return not price.startswith('−')
示例8: condition
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def condition(self):
text = CleanText('td')(self)
return not text.startswith('Aucune information disponible')
示例9: obj_url
# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import startswith [as 别名]
def obj_url(self):
url = CleanText('./LienDetail')(self)
if not url.startswith('http'):
url = u'http://www.entreparticuliers.com%s' % url
return url