Add civit model pull ability
This commit is contained in:
@@ -352,7 +352,12 @@ class Fetch:
|
||||
print(f"Fetching {entity}...")
|
||||
path = Path(client.path) / ('fetch_' + entity)
|
||||
items = list()
|
||||
first_page = client.make_get_request(url=f'{client.config.base_url}/api/v1/{entity}{client.build_query_string(params)}').json()
|
||||
url = f'{client.config.base_url}/api/v1/{entity}{client.build_query_string(params)}'
|
||||
first_page = client.make_get_request(url)
|
||||
if not first_page:
|
||||
with open(Path(client.path) / 'bugs.log', 'a') as f: f.write(url + '\n')
|
||||
return items
|
||||
first_page = first_page.json()
|
||||
if first_page.get('items', None): items.extend(first_page.get('items', None))
|
||||
if save:
|
||||
path.mkdir(exist_ok=True)
|
||||
@@ -419,7 +424,7 @@ class Fetch:
|
||||
for item in page_items: page_items_dict[item['id']] = item
|
||||
print(f'Added {len(page_items_dict) - l} images by {sort} sort crawl. {len(page_items_dict)} images total')
|
||||
|
||||
page_items = [key for key, value in page_items_dict.items()]
|
||||
page_items = [value for key, value in page_items_dict.items()]
|
||||
|
||||
|
||||
l = len(items)
|
||||
|
||||
Reference in New Issue
Block a user