Skip to content

Commit

Permalink
багфикс: в get_all() добавил order в params
Browse files Browse the repository at this point in the history
  • Loading branch information
leshchenko1979 committed Jul 27, 2020
1 parent 3f6bba7 commit 135559c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fast_bitrix24/bitrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ async def _request_list(self, method, item_list, real_len=None, real_start=0, pr
pbar = tqdm(total=real_len, initial=real_start)
for x in asyncio.as_completed((*tasks, self._sw.release_task)):
r, __ = await x
if r['result_error']:
raise RuntimeError(f'The server reply contained an error: {r["result_error"]}')
if method == 'batch':
if preserve_IDs:
r = r['result'].items()
Expand All @@ -222,6 +224,11 @@ async def _request_list(self, method, item_list, real_len=None, real_start=0, pr
return results

async def _get_paginated_list(self, method, params=None):
if params:
if 'order' not in [x.lower() for x in params.keys()]:
params.update({'order': {'ID': 'ASC'}})
else:
params = {'order': {'ID': 'ASC'}}
async with self._sw, aiohttp.ClientSession(raise_for_status=True) as session:
results, total = await self._request(session, method, params)
if not total or total <= 50:
Expand Down

0 comments on commit 135559c

Please sign in to comment.