Добавил возможность указывать последний успешный ID из переменной окружения LAST_ID
This commit is contained in:
@@ -3,4 +3,5 @@ API_TOKEN=jmkdjsfopjsef
|
||||
IBLOCKS=1,2,3
|
||||
DESTINATION_HOST=127.0.0.1
|
||||
DESTINATION_PORT=8000
|
||||
DESTINATION_PROTOCOL=http
|
||||
DESTINATION_PROTOCOL=http
|
||||
LAST_ID=0
|
||||
@@ -1,5 +1,7 @@
|
||||
import logging
|
||||
import json
|
||||
import os
|
||||
|
||||
import aiohttp
|
||||
import backoff
|
||||
from environs import load_dotenv
|
||||
@@ -30,7 +32,7 @@ class ApiExtractor:
|
||||
else:
|
||||
data['fields'] = json.dumps(self.fields + ["PROPERTY_*"], ensure_ascii=False)
|
||||
|
||||
min_id = state.get_state(f'iblock_{iblock_id}') or 0
|
||||
min_id = state.get_state(f'iblock_{iblock_id}') or os.getenv('LAST_ID') or 0
|
||||
data['bitrFilter'] = json.dumps({'>ID': str(min_id)}, ensure_ascii=False)
|
||||
abitrs = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user