[amazon] pep8 fixes
This commit is contained in:
parent
170db43de1
commit
f7e7e45760
5 changed files with 56 additions and 50 deletions
|
|
@ -30,6 +30,7 @@ from .pages import HomePage, LoginPage, AmazonPage, HistoryPage, \
|
|||
|
||||
__all__ = ['Amazon']
|
||||
|
||||
|
||||
class Amazon(LoginBrowser):
|
||||
BASEURL = 'https://www.amazon.com'
|
||||
MAX_RETRIES = 10
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ OrderOldPage, OrderNewPage
|
|||
|
||||
__all__ = ['AmazonFR']
|
||||
|
||||
|
||||
class AmazonFR(Amazon):
|
||||
BASEURL = 'https://www.amazon.fr'
|
||||
CURRENCY = u'€'
|
||||
|
|
|
|||
10
modules/amazon/fr/pages.py
Executable file → Normal file
10
modules/amazon/fr/pages.py
Executable file → Normal file
|
|
@ -28,6 +28,7 @@ import re
|
|||
# Ugly array to avoid the use of french locale
|
||||
FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre']
|
||||
|
||||
|
||||
class AmazonPage(HTMLPage):
|
||||
@property
|
||||
def logged(self):
|
||||
|
|
@ -84,8 +85,8 @@ class OrderPage(AmazonPage):
|
|||
# finalized payment amounts.
|
||||
# Payment for not yet shipped orders may change, and is not always
|
||||
# available.
|
||||
# TODO : Other French status applied ?
|
||||
return bool([x for s in [u'En préparation pour expédition']
|
||||
|
||||
return bool([x for s in [u'En préparation pour expédition'] # TODO : Other French status applied ?
|
||||
for x in self.doc.xpath(u'//*[contains(text(),"%s")]' % s)])
|
||||
|
||||
def decimal_amount(self, amount):
|
||||
|
|
@ -98,7 +99,9 @@ class OrderPage(AmazonPage):
|
|||
text = text.replace(month, str(idx + 1))
|
||||
return text
|
||||
|
||||
|
||||
class OrderNewPage(OrderPage):
|
||||
# Need to force encoding because of mixed encoding
|
||||
forced_encoding = True
|
||||
ENCODING = 'ISO-8859-15'
|
||||
is_here = u'//*[contains(text(),"Commandé le")]'
|
||||
|
|
@ -157,7 +160,8 @@ class OrderNewPage(OrderPage):
|
|||
'/following-sibling::div[1]/span/text()')[0].strip())
|
||||
|
||||
def date_num(self):
|
||||
return u' '.join(self.doc.xpath(
|
||||
return u' '.join(
|
||||
self.doc.xpath(
|
||||
'//span[@class="order-date-invoice-item"]/text()'
|
||||
)).replace('\n', '')
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from .fr.browser import AmazonFR
|
|||
|
||||
__all__ = ['AmazonModule']
|
||||
|
||||
|
||||
class AmazonModule(Module, CapShop):
|
||||
NAME = 'amazon'
|
||||
MAINTAINER = u'Oleg Plakhotniuk'
|
||||
|
|
@ -63,7 +64,6 @@ class AmazonModule(Module, CapShop):
|
|||
return self.browser.get_order(id_)
|
||||
|
||||
def iter_orders(self):
|
||||
|
||||
return self.browser.iter_orders()
|
||||
|
||||
def iter_payments(self, order):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue