minor fix
This commit is contained in:
23
main.py
23
main.py
@@ -379,27 +379,20 @@ def main(driver: WebDriver, logger = logging.getLogger('main')):
|
|||||||
progress['number'] = number
|
progress['number'] = number
|
||||||
progress['index'] = i-1
|
progress['index'] = i-1
|
||||||
|
|
||||||
if (x := item['category_id']) not in categories:
|
if (category := categories.get(o := item['category_id'])) is None:
|
||||||
if 'error' in (res := fetch(f'{base}/categories/{x}.json?api_token={profile.token}')):
|
if 'error' in (category := fetch(f'{base}/categories/{o}.json?api_token={profile.token}')):
|
||||||
error = res['error']
|
error = category['error']
|
||||||
code = res['code']
|
code = category['code']
|
||||||
logger.warning("Error while fetching 'category' (code: %s, message: %s); skipping", code, error)
|
logger.warning("Error while fetching 'category' (code: %s, message: %s); skipping", code, error)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
categories[x] = res
|
if (client := clients.get(o := item['client_id'])) is None:
|
||||||
|
if 'error' in (client := fetch(f'{base}/clients/{o}.json?api_token={profile.token}')):
|
||||||
if (x := item['client_id']) not in clients:
|
error = client['error']
|
||||||
if 'error' in (res := fetch(f'{base}/clients/{x}.json?api_token={profile.token}')):
|
code = client['code']
|
||||||
error = res['error']
|
|
||||||
code = res['code']
|
|
||||||
logger.warning("Error while fetching 'client' (code: %s, message: %s); skipping", code, error)
|
logger.warning("Error while fetching 'client' (code: %s, message: %s); skipping", code, error)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
clients[x] = res
|
|
||||||
|
|
||||||
category = categories.get(item['category_id'])
|
|
||||||
client = clients.get(item['client_id'])
|
|
||||||
|
|
||||||
identity = client['external_id'] if client['company'] else profile.person
|
identity = client['external_id'] if client['company'] else profile.person
|
||||||
date: str = item['issue_date']
|
date: str = item['issue_date']
|
||||||
kind: str = item['kind']
|
kind: str = item['kind']
|
||||||
|
|||||||
Reference in New Issue
Block a user