Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DTS API of the Alfred Escher-Briefedition to registry.json #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <https://dts-aggregator.herokuapp.com/>.
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.
Expand All @@ -22,3 +18,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
```
3 changes: 2 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
24 changes: 12 additions & 12 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -40,16 +40,6 @@
"name": "Frank Grieshaber"
}
},
{
"endpoint": "https://dts.perseids.org/",
"label":"Perseids",
"protocol": "dts",
"status": "experimental",
"contact": {
"email": "mailto:[email protected]",
"name": "Zachary Fletcher"
}
},
{
"endpoint": "https://teipublisher.com/exist/apps/vangogh/api/dts",
"label":"Van Gogh Letters (TEIPublisher demo)",
Expand All @@ -69,5 +59,15 @@
"email": "mailto:[email protected]",
"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:[email protected]",
"name": "Staatsarchiv | Kanton Zürich"
}
}
]}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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