added page limit pass through variable

This commit is contained in:
aj 2020-01-25 20:30:15 +00:00
parent fc45e0c03a
commit 2394ccc536

View File

@ -98,7 +98,8 @@ class Network:
username: str = None, username: str = None,
limit: int = None, limit: int = None,
from_time: datetime = None, from_time: datetime = None,
to_time: datetime = None) -> Optional[List[Scrobble]]: to_time: datetime = None,
page_limit: int = 50) -> Optional[List[Scrobble]]:
if limit is not None: if limit is not None:
logger.info(f'pulling {limit} tracks') logger.info(f'pulling {limit} tracks')
else: else:
@ -113,7 +114,7 @@ class Network:
if to_time is not None: if to_time is not None:
params['to'] = int(to_time.timestamp()) params['to'] = int(to_time.timestamp())
iterator = PageCollection(net=self, method='user.getrecenttracks', params=params, response_limit=limit) iterator = PageCollection(net=self, method='user.getrecenttracks', params=params, response_limit=limit, page_limit=page_limit)
iterator.response_limit = limit + 1 if limit is not None else None iterator.response_limit = limit + 1 if limit is not None else None
iterator.load() iterator.load()