Фикс ошибки неправильной загрузки обработки данных из getnativeiblockelementslist
This commit is contained in:
parent
9121013eb8
commit
0dfe1d8b7e
|
@ -30,7 +30,11 @@ class ApiExtractor:
|
|||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url=url, headers=self.headers,
|
||||
data=data) as resp:
|
||||
try:
|
||||
return json.loads(await resp.text())
|
||||
except json.JSONDecodeError:
|
||||
logging.error(f'Получены неверные данные - {resp.text()}')
|
||||
return {}
|
||||
|
||||
@backoff.on_exception(backoff.expo, (aiohttp.ClientResponseError, aiohttp.ClientConnectorError,
|
||||
aiohttp.ServerDisconnectedError), base=2, factor=1,
|
||||
|
@ -45,8 +49,10 @@ class ApiExtractor:
|
|||
data['fields'] = json.dumps(self.fields + fields, ensure_ascii=False)
|
||||
else:
|
||||
data['fields'] = json.dumps(self.fields + ["PROPERTY_*"], ensure_ascii=False)
|
||||
|
||||
min_id = state.get_state(f'iblock_{iblock_id}') or os.getenv('LAST_ID') or 0
|
||||
if os.getenv('LAST_ID').isdigit():
|
||||
if int(min_id) < int(os.getenv('LAST_ID')):
|
||||
min_id = os.getenv('LAST_ID')
|
||||
data['bitrFilter'] = json.dumps({'>ID': str(min_id)}, ensure_ascii=False)
|
||||
abitrs = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user