Skip to content

Commit

Permalink
feat(management): add comment to fetch and store iiif data
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Sep 25, 2024
1 parent adb275e commit 3d6ad62
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apis_ontology/management/commands/updateiiif.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django.core.management.base import BaseCommand
import json
import pathlib
import requests


class Command(BaseCommand):
help = "Update iiif cache"

def handle(self, *args, **options):
full_dict = {}
try:
titles = requests.get("https://iiif.acdh-dev.oeaw.ac.at/images/sicprod/", headers={"Accept": "application/json"})
for title in titles.json():
full_dict[title] = requests.get(f"https://iiif.acdh-dev.oeaw.ac.at/images/sicprod/{title}", headers={"Accept": "application/json"}).json()
except Exception as e:
print(e)
pathlib.Path("data/iiif.json").write_text((json.dumps(full_dict, indent=2)))

0 comments on commit 3d6ad62

Please sign in to comment.