Skip to content

Commit

Permalink
Fix prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Nov 18, 2023
1 parent 9ca87a3 commit 707f94c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion budgetkey_api/modules/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
5 changes: 3 additions & 2 deletions prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 707f94c

Please sign in to comment.