From 0c52cab8e02cbcfe40a73633f027276b830c23eb Mon Sep 17 00:00:00 2001 From: Renato Date: Mon, 6 Nov 2023 15:51:23 +0100 Subject: [PATCH 1/6] small updates - update flask version => 3.0.0 - count_total_item : bypass json conversion when request response does not have a 200 status - add a simple Dockerfile for deploiment purpose --- Dockerfile | 12 ++++++++++++ app/__init__.py | 3 ++- requirements.txt | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf6a852 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-alpine as python + +RUN mkdir /root/DTS-aggregator +WORKDIR /root/DTS-aggregator + +COPY ["./", "./"] + +RUN pip install -r requirements.txt + +EXPOSE 5000 + +CMD ["flask", "run", "--host=0.0.0.0"] \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py index b4947c6..90e711e 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -24,7 +24,8 @@ def count_total_items(baseuri: str) -> int: """ h = {"User-Agent": "DTS Client"} entry_request = requests.get(baseuri, headers=h) - ENDPOINTS = entry_request.json() + if entry_request.status_code == 200: + ENDPOINTS = entry_request.json() try: ROOT_COLLECTION = requests.get( diff --git a/requirements.txt b/requirements.txt index 1e670c7..7c08aeb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -flask>=1.1.1,<=2.0.0 +flask>=3.0.0 flask-cors>=3.0.8,<=4.0.0 gunicorn requests From 07753aeb02de16dadc54d347a08cd884f38135cc Mon Sep 17 00:00:00 2001 From: Renato Date: Mon, 13 Nov 2023 15:07:31 +0100 Subject: [PATCH 2/6] update registry (Ecole des chartes demo) --- registry.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry.json b/registry.json index bf5f41e..4791739 100644 --- a/registry.json +++ b/registry.json @@ -11,7 +11,7 @@ } }, { - "endpoint": "http://dev.chartes.psl.eu/api/nautilus/dts", + "endpoint": "https://dev.chartes.psl.eu/dts", "protocol": "dts", "status": "demo", "label": "École des Chartes Demo", From 33d9bd6f59f3fead27288ac87b136891d9f5f613 Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Wed, 24 Jan 2024 10:07:33 +0100 Subject: [PATCH 3/6] Added DTS API of the Alfred Escher-Briefedition to registry.json (via e-editiones map) --- registry.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/registry.json b/registry.json index bf5f41e..7257e33 100644 --- a/registry.json +++ b/registry.json @@ -69,5 +69,15 @@ "email": "mailto:thibault.clerice@chartes.psl.eu", "name": "Thibault Clérice" } - } + }, + { + "endpoint": "https://www.briefedition.alfred-escher.ch/exist/apps/escher/api/dts/", + "protocol": "dts", + "status": "production", + "label": "Alfred Escher-Briefedition", + "contact": { + "email": "mailto:staatsarchivzh@ji.zh.ch", + "name": "Staatsarchiv | Kanton Zürich" + } + } ]} From 6012524440d770d0aa1a715429076c0300da68a5 Mon Sep 17 00:00:00 2001 From: Renato Date: Thu, 25 Jan 2024 10:06:07 +0100 Subject: [PATCH 4/6] update the README.md with containerization documentation --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 7ee5696..0d012e6 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,17 @@ pip install -r requirements.txt ```bash flask run ``` + +## Run the aggregator on a container (Docker/Podman) + +Navigate to the aggregator root folder, then run : + +```bash +docker build -t dts-agg-image . +``` + +start container with : + +```bash +docker run --rm --name dts-agg -itd -p 5000:5000 dts-agg-image +``` \ No newline at end of file From e3eabfec9ffe15e7d5cc68a89c9e1f3e6a64672b Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Thu, 25 Jan 2024 14:01:06 +0100 Subject: [PATCH 5/6] updated README --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d012e6..462c0c0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # DTS aggregator -An aggregator of known [DTS](https://w3id.org/dts/) APIs, implemented as a DTS API and running as a [Flask](https://flask.palletsprojects.com/) application. - -**What does it mean?** This registry is itself a DTS collection of DTS APIs. - -A demo version of the DTS aggregator is accessible at . +An aggregator of known [DTS](https://w3id.org/dts/) APIs, implemented as a DTS API and running as a [Flask](https://flask.palletsprojects.com/) application (this just means that the registry itself is a DTS collection of DTS APIs). A list of known APIs is maintained in [`registry.json`](./registry.json). Are you aware of a DTS API that is not listed there? Please add it to the registry file and open a Pull Request. From 2f46576295ee17b7db7e3aa5800290785906d3b5 Mon Sep 17 00:00:00 2001 From: Matteo Romanello Date: Tue, 6 Aug 2024 16:54:13 +0200 Subject: [PATCH 6/6] removed Perseids DTS API (unreachable) --- registry.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/registry.json b/registry.json index b0f5f62..ff5be54 100644 --- a/registry.json +++ b/registry.json @@ -40,16 +40,6 @@ "name": "Frank Grieshaber" } }, - { - "endpoint": "https://dts.perseids.org/", - "label":"Perseids", - "protocol": "dts", - "status": "experimental", - "contact": { - "email": "mailto:Zachary.Fletcher@tufts.edu", - "name": "Zachary Fletcher" - } - }, { "endpoint": "https://teipublisher.com/exist/apps/vangogh/api/dts", "label":"Van Gogh Letters (TEIPublisher demo)",