fix handling of old server - some wacky, wacky things were going on
@@ -275,7 +275,7 @@ class AlmaClass(QueryWithLogin):
jdata = req.json()
# Note this exception does not work in Python 2.7
except json.JSONDecodeError:
- if 'Central Authentication Service' in req.text:
+ if 'Central Authentication Service' in req.text or 'recentRequests' in req.url:
# this indicates a wrong server is being used;
# the "pre-feb2020" stager will be phased out
# when the new services are deployed
@@ -402,8 +402,8 @@ class AlmaClass(QueryWithLogin):
# will be wrong
# (the request ID can also be found from the javascript in the request
# response)
- assert response.url.split("/")[-3] == 'requests', 'Malformatted URL'
- request_id = response.url.split("/")[-1]
+ if response.url.split("/")[-1] == 'submission':
+ request_id = response.url.split("/")[-2]
self._staging_log['request_id'] = request_id
log.debug("Request ID: {0}".format(request_id))
@@ -417,6 +417,9 @@ class AlmaClass(QueryWithLogin):
staging_submission.raise_for_status()
data_page_url = staging_submission.url
+ elif response.url.split("/")[-3] == 'requests':
+ data_page_url = response.url
+
self._staging_log['data_page_url'] = data_page_url
dpid = data_page_url.split("/")[-1]
self._staging_log['staging_page_id'] = dpid
