Skip to content
Snippets Groups Projects
Commit 37f1ec1b authored by Benedikt von St. Vieth's avatar Benedikt von St. Vieth
Browse files

Gracefully exit when depositor is not able to fetch communities (probably because b2share is down).

parent 1ad09561
Branches
No related tags found
No related merge requests found
"""a b2share depositor."""
from furl import furl
from requests.exceptions import ConnectionError
import json
import logging
import requests
......@@ -88,8 +88,13 @@ class Depositor:
communitynames = {}
communityids = {}
# verify=False is needed while using fsd-cloud9 with self signed cert
try:
r = requests.get(self.b2shareurl + "communities/",
params=self.url_params, verify=self.insecure_ssl)
except ConnectionError:
logging.error('B2SHARE at {} currently not available'.format(
self.b2shareurl))
exit(1)
i = 0
for community in r.json()['hits']['hits']:
communitynames.update({i: community['name']})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment