Get item from database, or download if missing

This commit is contained in:
Edward Betts 2021-05-14 17:01:46 +02:00
parent 053a2174e9
commit a7e0a5fa8e

View file

@ -676,6 +676,16 @@ skip_isa = {
} }
skip_tags = {"Key:addr:street"} skip_tags = {"Key:addr:street"}
def get_item(item_id):
item = model.Item.query.get(item_id)
if item:
return item
item = get_and_save_item(f"Q{item_id}")
database.session.add(item)
database.session.commit()
return item
def get_items(item_ids): def get_items(item_ids):
items = [] items = []
for item_id in item_ids: for item_id in item_ids: