-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add integration with ckanext-status
so far this just checks the iiif server status
- Loading branch information
1 parent
a8f9027
commit d637dd1
Showing
3 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
# | ||
# This file is part of ckanext-nhm | ||
# Created by the Natural History Museum in London, UK | ||
|
||
from ckan.plugins import toolkit | ||
import requests | ||
|
||
|
||
def get_iiif_status(): | ||
health = {} | ||
|
||
url = toolkit.config.get('ckanext.iiif.image_server_url') | ||
r = requests.get(url + '/status') | ||
if r.ok: | ||
health['ping'] = True | ||
response_json = r.json() | ||
else: | ||
response_json = {} | ||
|
||
health['status'] = response_json.get('status') | ||
mss = response_json.get('profiles', {}).get('mss', {}) | ||
health['specimens'] = mss.get('mss_status', {}).get('status', ':(') | ||
health['es'] = mss.get('es', {'status': 'red', 'response_time': None}) | ||
|
||
return health |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters