diff --git a/budgetkey_api/modules/search.py b/budgetkey_api/modules/search.py index fceee6b..c8b5a79 100644 --- a/budgetkey_api/modules/search.py +++ b/budgetkey_api/modules/search.py @@ -4,7 +4,7 @@ from apies import apies_blueprint -DATAPACKAGE_BASE = 'pkg-cache/{}.json' +DATAPACKAGE_BASE = 'pkg-cache/{}/datapackage.json' ES_HOST = os.environ.get('ES_HOST', 'localhost') ES_PORT = int(os.environ.get('ES_PORT', '9200')) INDEX_NAME = os.environ.get('INDEX_NAME', 'budgetkey') diff --git a/prepare.py b/prepare.py index f45e933..341e33d 100644 --- a/prepare.py +++ b/prepare.py @@ -6,8 +6,9 @@ if __name__ == '__main__': for t in TYPES: - print('Fetching', t) - os.makedirs('/'.join(DATAPACKAGE_BASE.split('/')[:-1]), exist_ok=True) + dirname = '/'.join(DATAPACKAGE_BASE.split('/')[:-1]).format(t) + print('Fetching', t, 'to', dirname) + os.makedirs(dirname, exist_ok=True) r = requests.get(SRC_DATAPACKAGE_BASE.format(t)) with open(DATAPACKAGE_BASE.format(t), 'wb') as f: f.write(r.content)