paypal: Handle multiple pages
This commit is contained in:
parent
4ed53b5de9
commit
ca4c97b42f
2 changed files with 15 additions and 6 deletions
|
|
@ -76,8 +76,11 @@ class Paypal(BaseBrowser):
|
|||
|
||||
def get_history(self, account):
|
||||
self.history()
|
||||
for transaction in self.page.iter_transactions(account):
|
||||
yield transaction
|
||||
parse = True
|
||||
while parse:
|
||||
for trans in self.page.iter_transactions(account):
|
||||
yield trans
|
||||
parse = self.page.next()
|
||||
|
||||
def history(self):
|
||||
self.location('/en/cgi-bin/webscr?cmd=_history&nav=0.3.0')
|
||||
|
|
|
|||
|
|
@ -121,9 +121,9 @@ class AccountPage(BasePage):
|
|||
|
||||
|
||||
class DownloadHistoryPage(BasePage):
|
||||
def download(self):
|
||||
def download(self, days=90):
|
||||
today = datetime.date.today()
|
||||
start = today - datetime.timedelta(days=90)
|
||||
start = today - datetime.timedelta(days)
|
||||
self.browser.select_form(name='form1')
|
||||
self.browser['to_c'] = str(today.year)
|
||||
self.browser['to_a'] = str(today.month)
|
||||
|
|
@ -246,16 +246,22 @@ class HistoryPage(BasePage):
|
|||
time_format = "%H:%M:%S"
|
||||
return date_format, time_format, months
|
||||
|
||||
def filter(self):
|
||||
def filter(self, days=90):
|
||||
date_format = self.guess_format()[0]
|
||||
today = datetime.date.today()
|
||||
start = today - datetime.timedelta(days=90)
|
||||
start = today - datetime.timedelta(days)
|
||||
self.browser.select_form(name='history')
|
||||
self.browser['dateoption'] = ['dateselect']
|
||||
self.browser['from_date'] = start.strftime(date_format)
|
||||
self.browser['to_date'] = today.strftime(date_format)
|
||||
self.browser.submit(name='show')
|
||||
|
||||
def next(self):
|
||||
if self.document.xpath('//span[@class="pageNext"]'):
|
||||
self.browser.select_form(name='history')
|
||||
self.browser.submit(name='next')
|
||||
return True
|
||||
|
||||
def parse(self):
|
||||
emonths = ['January', 'February', 'March', 'April',
|
||||
'May', 'June', 'July', 'August',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue