amazon bills

This commit is contained in:
Baptiste Delpey 2015-08-11 16:03:28 +02:00 committed by Romain Bignon
commit 583923622b
3 changed files with 56 additions and 1 deletions

View file

@ -111,8 +111,16 @@ class OrderNewPage(OrderPage):
order.discount = self.discount()
order.shipping = self.shipping()
order.total = self.grand_total()
order._bill = self.bill()
return order
def bill(self):
pdf = self.doc.xpath(u'//a[contains(text(), "Imprimer une facture")]')
htlm = self.doc.xpath(u'//a[contains(text(), "Imprimer un récapitulatif de commande")]')
format = u'pdf' if pdf else u'html'
url = pdf[0].attrib['href'] if pdf else htlm[0].attrib['href']
return {'url': url, 'format': format}
def order_date(self):
return datetime.strptime(
re.match(u'.*Commandé le ([0-9]+ [0-9]+ [0-9]+) .*',